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

View all the Fabric Data Days sessions on demand. View schedule

Reply
JoeNewton
Frequent Visitor

% comp works for 1 week, but breaks with 4 week view?

Hi, 

 

I have successfully added a % comp to my one week view that looks like this for headers:

 

Retailer | 2022 sales | 2021 sales | % comp |

 

But in my 4 week tab, which has the following relative dates, it doesn't work:

 

Date added to filter, relative date, is in the last 4 weeks. 

 

The problem is that the amounts are correct, but it should be a negative number but it is positive. I have no idea why or how to fix. For example, it says 6% when it should be -6%. 

 

Hopefully this all makes sense, thanks!

1 ACCEPTED SOLUTION

OK so I found the issue. It was calculating correctly, but power bi was not showing the negative. I have no idea why not, but when I hovered my mouse over it I was able to see that it was in fact negative. I changed the format to red to show this. 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@JoeNewton ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Usually formula is divide( [current] -[prior],[prior])

 

 

Power BI — Week on Week and 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...
https://www.youtube.com/watch?v=pnAesWxYgJ8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

OK so I found the issue. It was calculating correctly, but power bi was not showing the negative. I have no idea why not, but when I hovered my mouse over it I was able to see that it was in fact negative. I changed the format to red to show this. 

So when I use your solution the % values get very wrong for some reason.

 

YOY Growth % = DIVIDE('Top Customers Data'[POS $]-'Top Customers Data'[POS $ LY], 'Top Customers Data'[POS $ LY])
 
This gets:
 
Retailer: X
POS $: 608k
POS $ LY: 644k
YOY Growth %: 598%
 
Before i had:

POS $ LY % difference from POS $ =
VAR __BASELINE_VALUE = SUM('Top Customers Data'[POS $])
VAR __VALUE_TO_COMPARE = SUM('Top Customers Data'[POS $ LY])
RETURN
    DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
 
Which got the correct % but negative
@amitchandak Added an @ to you in case you lost the thread 🙂

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors