如何从Power Query M(Power BI)中另一个表中的特定clumn获取最小值?

时间:2021-03-04 17:07:20

标签: powerbi powerquery

我的数据源中有表,它是从数据库加载的,其中包含带有日期的列。我需要从该列中获取 MIN 和 MAX 值,并将值用作在 Power BI 中创建另一个(计算)表的参数。请问我该怎么做? 我尝试使用 data _null_; /* The relevant columns are probably named differently; Check the table sashelp.vcolumn what the values in COLTYPE for character variables actually are Don't know exactly out of my head */ set sashelp.vcolumn(where=(MEMNAME eq 'MY_TABLE' and COLTYPE in ('CHAR', 'VARCHAR'))) end=eof; attrib COLNAMES format=$1000.; retain COLNAMES; /* the following two lines concatenate all extracted column names; choose one of the two */ /*concatenate all variable names in a string using || operator*/ COLNAMES = compbl(COLNAMES) || ', ' || compbl(COLNAME); /*or via function catx*/ colnames=catx(', ',colnames,colname); /*define a macro variable to hold all determined columns*/ if eof then do; call symput('M_COLNAMES', compbl(COLNAMES)); end; run; /*print all found columns*/ %put Character columns: &M_COLNAMES.; 之类的东西,但这会返回整行,但我只需要“SortTime”列中的值......你能帮我吗?

1 个答案:

答案 0 :(得分:2)

Start = List.Min(MyTable[SortTime])