Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowHello everyone,
I tired to calculate amount percentage comparing to value of the same day on the same week.
For example, if I want to calculate amount for 2020/8/3(Mon), I need to compare it to amount of 2019/8/5(Mon).
Date | Amount |
2020/8/1 | 10 |
2020/8/2 | 20 |
2020/8/3 | 30 |
2020/8/4 | 40 |
2019/8/3 | 15 |
2019/8/4 | 25 |
2019/8/5 | 35 |
I think it's possible to create a Measure with calculate, datadd etc, but I can't get correct value due to incorrect syntax.
How should I write it correctly?
Thanks in advance.
Vladi
Solved! Go to Solution.
@PbiCeo , it will work with a date table marked as date.
example
Week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))
refer Power BI — Day Intelligence
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...
Power BI — WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
@PbiCeo , it will work with a date table marked as date.
example
Week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))
refer Power BI — Day Intelligence
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...
Power BI — WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
Thanks for your advice,
Btw, is there any way to include leap year with the code you provided?
Hi @PbiCeo ,
You cna have a look at this blog.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
24 | |
15 | |
13 | |
12 | |
8 |
User | Count |
---|---|
30 | |
22 | |
15 | |
14 | |
14 |