Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
As i am working on improving performance of measures, which function should i use to get the latest date from a date table?
Max(Date) or LastDate(Date)
Thanks
Solved! Go to Solution.
in this article there is a short paragraph about the 2
https://www.sqlbi.com/articles/semi-additive-measures-in-dax/
basically LASTDATE returns a table of one column and one row, while MAX returns scalar value
accoriding to the article this code is equivalent to LASTDATE
FILTER ( ALL( 'Date'[Date] ), 'Date'[Date] = MAX ( 'Date'[Date] ) )
so to answer your question if you need a scalar I'd use MAX
on optimization in general - I recommend watching this video and in avoiding iterator functions on full tables if possible
https://www.sqlbi.com/tv/optimizing-dax-queries/
Hi @jatneerjat,
Have you solved your problem?
If you have solved, please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
Best Regards,
Cherry
in this article there is a short paragraph about the 2
https://www.sqlbi.com/articles/semi-additive-measures-in-dax/
basically LASTDATE returns a table of one column and one row, while MAX returns scalar value
accoriding to the article this code is equivalent to LASTDATE
FILTER ( ALL( 'Date'[Date] ), 'Date'[Date] = MAX ( 'Date'[Date] ) )
so to answer your question if you need a scalar I'd use MAX
on optimization in general - I recommend watching this video and in avoiding iterator functions on full tables if possible
https://www.sqlbi.com/tv/optimizing-dax-queries/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
65 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |