Dax度量显示上个月



我有一个表显示如下:

AccountingMonth | AccountingYear | MonthType
January         | 2019           | Other
February        | 2019           | Other
March           | 2019           | Other
April           | 2019           | Other
May             | 2019           | Other
June            | 2019           | Other
July            | 2019           | Other
August          | 2019           | Other
September       | 2019           | Other
October         | 2019           | Other
November        | 2019           | Other
December        | 2019           | Other
January         | 2020           | Other
February        | 2020           | Previous Month
March           | 2020           | Current Month
April           | 2020           | Next Month

我正在尝试创建一个度量值来选择上个月。如何使用VALUES进行筛选?

GaugePreviousMonthTitle =
VAR SelectedValues =
    VALUES ( Budget[AccountingMonth] ) ------filter for MonthType of Previous Year???
RETURN
    SelectedValues
GaugePreviousMonthTitle =
CALCULATE(
    VALUES ( Budget[AccountingMonth] ), 
    Budget[MonthType]="Pevious Month"
   )

这里的一个假设是"Previous Month"标志在表中总是唯一的,因此总是只返回一个AccountingMonth。如果不是这样,则需要保护结果不返回多个值。

最新更新