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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cham
Post Patron
Post Patron

Difference between previous week

Hi,

 

 

Here is my data set,

Date SpendPay
22-07-19589.32425.22
24-07-193652.851833.72
21-07-193659.52744.64
24-07-192312.591726.67
24-07-19519.59347.25
24-07-1921178.4817955.15
24-07-193016.453734.56
22-07-192130.751562.65
31-07-19107.5268.16
31-07-196545.5
31-07-191430.741078.24
31-07-19108.315534.32
01-08-191011.2310910.91

 

I created a mesaure using this data set as below,

%Amount = (SUM('Sheet1'[Spend]) - SUM('Sheet1'[Total Pay])) / SUM('Sheet1'[Spend])

 

I want to get the diffrence between previous week %Amoun with this week. How can i do that?Hope this will help you because i provide the data set.

10 REPLIES 10
Anonymous
Not applicable

Hey @cham 

You can use a calculated column:

% = CALCULATE(((SUM(T20[Spend]) - SUM(T20[Pay])) / SUM(T20[Spend])),
FILTER(T20, T20[WEEKNUM] = EARLIER(T20[WEEKNUM])))

Where WEEKNUM is another column:

WEEKNUM = WEEKNUM(T20[Date ])

I did NOT QA this solution.

2019-07-31 13_34_08-papercut - Remote Desktop Connection.png

 

Thanks!
A

Hi @Anonymous ,

 

What is this T20 you mentioned in your measure? Can you please explain it to me?

Anonymous
Not applicable

@cham 

Thats the table name.

In your case it is Sheet1

Thansk!
A

Hi @Anonymous ,

 

This is not working see below pic,

p.PNG

 

Could you please help me to sort this?

Anonymous
Not applicable

@cham 

You'll have to create a column, not a measure.

Cannot use EARLIER in a measure.

But, you can find ways to workaround this.

 

Thanks!
A

Hi @Anonymous ,

 

Still its giving me an error,

 

p.PNG

Hi @Anonymous ,

 

I want to create a mesuare because this one is not wokring if we create it as column. I already creted a amont% in measure.

 

Do you know how to get the differenece between previous week using measure?

Anonymous
Not applicable

@cham 

Try adding the WEEKNUM and use it in your calculations.

That's the basic idea.

Thanks!
A

Anonymous
Not applicable

@cham 

You are missing a bracket after 

SUM(T20[Pay]))

Or other syntax issue.

Pay attention you have all barackets and other characters in place.

 

Thanks!
A

Anonymous
Not applicable

Hi @cham ,

 

Check if this helps.

 

https://community.powerbi.com/t5/Desktop/Variance-over-week-DAX/m-p/479504#M223174

 

Cheers

 

CheenuSing

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.