[英]Dax Measure to show previous month
I have a table that shows as this:我有一个表格显示如下:
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
I am trying to create a measure to just select the previous month.我正在尝试创建一个仅选择上个月的度量。 How do I filter using VALUES?
如何使用 VALUES 进行过滤?
GaugePreviousMonthTitle =
VAR SelectedValues =
VALUES ( Budget[AccountingMonth] ) ------filter for MonthType of Previous Year???
RETURN
SelectedValues
GaugePreviousMonthTitle =
CALCULATE(
VALUES ( Budget[AccountingMonth] ),
Budget[MonthType]="Pevious Month"
)
An assumption here is that "Previous Month" flag is always unique in the table, and thus will always return only one AccountingMonth.这里的一个假设是“上个月”标志在表中始终是唯一的,因此将始终只返回一个 AccountingMonth。 If that's not true, you will need to protect the result from returning multiple values.
如果不是这样,您将需要保护结果免于返回多个值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.