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.
Hello - I am using the QTD measure below and it works fine.
However, the YTD measure just returns a blank value. I know there are various ways to calculate YTD, but I am trying to standardized my formulaes and I like this formula because it hides future dates with no values. Any idea why the YTD is returning blank...and how to fix it but still maintaining this general formula structure.
Solved! Go to Solution.
Hi @Anonymous ,
You can use the following two measure:
YTD Orders = CALCULATE(SUM('Orders 2'[Net Price]), FILTER('Date Table', 'Date Table'[Date] >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1)), FILTER('Date Table', 'Date Table'[Date] <= TODAY()))
QTD Orders = CALCULATE(SUM('Orders 2'[Net Price]), FILTER('Date Table', 'Date Table'[Date] >= DATE ( YEAR (TODAY()), ROUNDUP(DIVIDE(MONTH(TODAY()),3 ),0 ) *3 -2, 1)), FILTER('Date Table', 'Date Table'[Date] <= TODAY()))
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @Anonymous ,
You can use the following two measure:
YTD Orders = CALCULATE(SUM('Orders 2'[Net Price]), FILTER('Date Table', 'Date Table'[Date] >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1)), FILTER('Date Table', 'Date Table'[Date] <= TODAY()))
QTD Orders = CALCULATE(SUM('Orders 2'[Net Price]), FILTER('Date Table', 'Date Table'[Date] >= DATE ( YEAR (TODAY()), ROUNDUP(DIVIDE(MONTH(TODAY()),3 ),0 ) *3 -2, 1)), FILTER('Date Table', 'Date Table'[Date] <= TODAY()))
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
You can create your measure like here .
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
@stevedep Thanks Steve. I tried that and for some reason it still returns blank. But I see in the DAX editor you got it to work for you. Not sure why it is not on my data set. I can of course just use a sum of total measure which works just fine. But my original intention was to try and stay with the same formula structure that I am using in the MTD and QTD measures as I referenced above. I thought by just replacing "Quarter" with "Year" it would work, but it does not.
@Anonymous , Try to use time intelligence
QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
YTD QTY forced=
var _max = today()
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |