使用Power BI中的度量动态过滤列
问题描述:
有一个包含FY的列,即 FY19, FY18, FY17等。
There is a column with FY i.e. "FY19","FY18","FY17" etc.
我创建了一个用于计算当前FY的度量:
I Created a measure which calculates the current FY:
CurrFY =
CONCATENATE (
"FY",
IF (
MONTH ( TODAY () ) <= 3,
VALUE ( FORMAT ( TODAY (), "YY" ) ),
VALUE ( FORMAT ( TODAY (), "YY" ) ) + 1
)
)
例如输出: FY19
e.g. output: "FY19"
现在,我需要使用从CurrFY度量中获得的当前FY,基于FY列过滤报表。
Now i need to filter the report based on the FY column using the current FY i get from the CurrFY measure.
我该怎么做?
答
使用该度量在表上创建一个计算列
Create a calculated column on your table using that measure
FYFilter = IF(Table1[FY] = [CurrFY], 1, 0)
然后将该列添加为报表级别过滤器,其中 FYFilter
为1。
Then add that column as a report level filter where FYFilter
is 1.