Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
PbiCeo
Helper II
Helper II

How to calculate amount percentage comparing to value of the same day of week

Hello 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).

DateAmount
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.


Measure = SUM ( 'table'[Amount] ) / CALCULATE (
SUM ( 'table'[Amount] ), FILTER('table',
DATEADD ( 'table'[Date], -364, DAY )))


How should I write it correctly?
Thanks in advance.
Vladi

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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...

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@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...

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak ,

Thanks for your advice,

Btw, is there any way to include leap year with the code you provided?

harshnathani
Community Champion
Community Champion

Hi @PbiCeo ,

 

You cna have a look at this blog.

 

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.