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 All,
I created a YTD measure that ignores my month slicer visual by using the following:
Solved! Go to Solution.
@Anonymous , All(calendar(Date) is not closed. ) is missing . Remove one at the end
Hi I have a accounting period date column from which I have month as a slicer
Need to show Current year YTD and whole Previous Year YTD both in a single table
Current Year YTD should be filtered by month and Previous Year YTD should ignore the month slicer selection and it should show Previous year YTD for the whole year.
For example:
Month | Current year YTD | Previous Year YTD |
Jan | 10 | 5 |
Feb | 10 | 5 |
Mar | 10 | 5 |
Apr | 10 | 5 |
May | 10 | 5 |
Jun | 10 | 5 |
Jul | 10 | 5 |
Aug | 10 | 5 |
Sep | 10 | 5 |
Oct | 10 | 5 |
Nov | 10 | 5 |
Dec | 10 | 5 |
Results expected:
Month - July
Current year YTD - 70 (From Jan to July)
Previous year YTD - 60 From (Jan to December)
Dax used :
Please help me with revised Dax
@Anonymous , for YTD and last year YTD
Try
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Power BI — YTD Questions — Time Intelligence 1–5
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
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/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
Hi @amitchandak ,
When I use your Last YTD Sales as shown below & I select a month in my slicer it filters this PY YTD column to the selected month. What I am trying to do is show the CY YTD & PY YTD columns as true year to date columns that ignore my month slicer (I have my month slicer because I want other columns to filter based on the month selected).
@Anonymous , Can you share an example. I checked in a shared blog file, If I filter Aug 19, I get YTD till Aug 19 and prior YTD till Aug 18.
If want to ignore slicer, try this year vs last year option.
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31")
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
This helped me solve my issue while browsing for solution. Thanks!!
🙂
Hi @amitchandak
Here is the error i receive when I use the last year function
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
@Anonymous , All(calendar(Date) is not closed. ) is missing . Remove one at the end
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 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |