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'm getting mad...
I would like to represent turnover YTD, but I would like to use a slicer to determine when YTD ends. That means I would like to set the slicer to April in the middle of May and then YTD will be calculated until 31.04. Can you tell me how this is possible?
Thank you very much and best regards
Solved! Go to Solution.
For YTD, you can use datesytd and totalytd. You can try add filter to restrict the month
YTD Sales =
var _max = maxx(date,endofmonth(dateadd(date[date],-1,Month)))
return
CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date])),'Date'[Date]<=_max)
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
For YTD, you can use datesytd and totalytd. You can try add filter to restrict the month
YTD Sales =
var _max = maxx(date,endofmonth(dateadd(date[date],-1,Month)))
return
CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date])),'Date'[Date]<=_max)
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
When I tried this solution, it said the syntax for date is incorrect. Do you know how to resolve this issue?
@amitchandakThank you for your fast response. But I forgott to mention, that I wamt to use a slicer to select the YTD-Month/-Year.
So I tried this:
But it doesn't work.
If you do not select the date from slicer, datesytd, and totalytd will take the last date of the calendar. make sure your month year is in date dimension table.
But sometimes I want to report YTD March in May.
Therefore I will need the slicer, I think.
Yes. Refer the slicer is giving me YTD, as do not have data in 2020.
Ok. I should have just believed you.
Thank you!👍
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 | |
99 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |