简体   繁体   中英

Difference between two MAX date Power BI DAX expressions

What is the difference between these two DAX expressions

[Max Date]:= MAX(DatesTable[Date])

If, in another measure, I then use it the following way:

FILTER(ALL(DatesTable), DatesTable[Date]<=[Max Date])

But then, I try this instead:

FILTER(ALL(DatesTable), DatesTable[Date]<=MAX(DatesTable[Date]))

The difference is that in the first example you calculated the MAX and pushed the result to a measure.

[Max Date]:= MAX(DatesTable[Date])

The measure can be used accross your report

In the second example you have a DAX expression where you directly use the result of the MAX in a filter.

FILTER(ALL(DatesTable), DatesTable[Date]<=MAX(DatesTable[Date]))

Now you cannot use this max in your report as a measure.

there is a third concept of variables. Most people want to keep the overview and use variables in their dax expressions:

MaxRowFilter = 
    var maxDate = MAX(DatesTable[Date])
    return FILTER(ALL(DatesTable), DatesTable[Date]<= maxDate )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM