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 have a project that started on July 2018, with daily data for sales. We would want to include a comarison with the sales for 2018 (July to December 2018) against the sales form 2019 (January up to today).
For 2019 data I am using the Quick Measure for Total Year To Date and everyhing works great.
However, I am struggling enormously with the formula for the data for 2018. I have tried the following:
1. Of course, if I include a hard coded 2018 as a condition in the Calculate, the filters don't work.
2. I have tried with SAMEPERIODLASTYEAR, as everyone recommends, but in my case, as I don't have data for a full year, is not viable.
3. I tried DATEADD from my Dates table, but I only get blanks.
DATEADD( Date.[Date], -1, YEAR))
Do you have any suggestions on another method that I could use?
Thanks a lot and kid regards!!
Solved! Go to Solution.
Hi @Rate ,
As suggested, you could create a calendar table with CALENDARAUTO() and then you could create the measure like below.
2019 = TOTALYTD(SUM('Data'[Sales]),'Table'[Date]) 2018 = var a =DATEADD('Table'[Date],-1,YEAR) return TOTALYTD(SUM('Data'[Sales]),a)
Here is the output.
You also could refer to my attachement.
Best Regards,
Cherry
Hi @Rate ,
As suggested, you could create a calendar table with CALENDARAUTO() and then you could create the measure like below.
2019 = TOTALYTD(SUM('Data'[Sales]),'Table'[Date]) 2018 = var a =DATEADD('Table'[Date],-1,YEAR) return TOTALYTD(SUM('Data'[Sales]),a)
Here is the output.
You also could refer to my attachement.
Best Regards,
Cherry
Hello Cherry,
Thank you very much!! Your solution was just amazing.
Thanks!
Can you try this
Measure=calculate( sum(sales),parellelperiod(Dimdate(date),-1,year))
@Rate do you have date dimension in your model? if no you need to add one and there are may posts on how to add one. Also make sure date dimension table is marked as date table .
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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 |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |