Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I am trying to understand what is happening beneath the surface with functions like DATESYTD and DATESBETWEEN. The scenario:
Measure 1 - Using TOTALYTD - ok
Measure 2 - Using CALCULATE and DATESYTD
Measure 3 - Using CALCULATE and DATESBETWEEN
All three work as expected and produce the expected result. Curiosity has me wondering how the 2nd and 3rd are doing so relative to the matrix layout. In my expressions I do not refer to of modify (clear) the filters on Year, Month, Day.
Given DATESYTD and DATESBETWEEN return a single column table.
If I wrote the expression using the custom technique with FILTER then I'd need to explicitly clear the filters on those columns or the entire Calendar table.
I assume DATESYTD and DATESBETWEEN are doing this but is there any documented details on how these functions work?
Measure 2 = CALCULATE ( [Total, DATESYTD ( 'Calendar'[Date] ) ) Measure 3 = CALCULATE ( [Total], DATESBETWEEN ( 'Calendar'[Date], STARTOFYEAR ( 'Calendar'[Date] ), LASTDATE ( 'Calendar'[Date] ) ) )
Note, am not concerned about the theory of other functions (unless they relate to this topic), am well aware of when and how simple functions like MAX/MIN should be used.
Solved! Go to Solution.
The reason is explained in this article: https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/
Giving this a slight bump. Anyone?
The reason is explained in this article: https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/
Thank you @marcorusso, hit the nail on the head (again!).
Mid-way through the article I was saying to myself "but it works irrespective of Mark as Date table" as that was part of my testing. Only a couple of paragraphs later did I read about when the Date column is the key in the relationship.
My life feels much more complete now
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
21 | |
18 | |
14 | |
11 |
User | Count |
---|---|
44 | |
35 | |
25 | |
22 | |
22 |