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

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.

Reply
Frankmeister1
Frequent Visitor

Profit difference compared to previous week's profit.

Hi all,

 

I'm currently using a measure to calculate the profit for my department. Which is made up from two other measures:

Profit = Pricelist[income Total]-Pricelist[costs]

I'm using the profit measure on a dashboard with the "card" function, in combination with a silcer with a week filter. So I can show the profit for each week when the user changes the week. 

 

Now I want to showcase the % increase / decrease ( or the total increase / decrease) in profit compared to the week before. 

 

I've been looking and other who had the same issue on this forum but I can't seem to understand what I'm doing wrong. 

My date table is connected to all the tables which are used to calculate the profit. 

 

I found this measure: 

profit difference = CALCULATE(SUM(Date[Profit.]), LASTDATE(Date[Date])) - CALCULATE(SUM(Date[Profit.]),DATEADD(Date[Date], -7,DAY)) But the outcome is not what I want. Because it shows me the profit from the week prior to the one selected, but not the difference.
 
Thanks in advance.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Frankmeister1 , this shoudlbe like

 

profit difference = CALCULATE(SUM(Date[Profit.])) - CALCULATE(SUM(Date[Profit.]),DATEADD(Date[Date], -7,DAY))

 

or with help from week rank column in date table

 

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

 

Try measure like

 

This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

WTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank]) && 'Date'[WeekDay]<=max('Date'[WeekDay])-1))
LWTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1 && 'Date'[WeekDay]<=max('Date'[WeekDay])-1 ))

 

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Frankmeister1 , this shoudlbe like

 

profit difference = CALCULATE(SUM(Date[Profit.])) - CALCULATE(SUM(Date[Profit.]),DATEADD(Date[Date], -7,DAY))

 

or with help from week rank column in date table

 

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

 

Try measure like

 

This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

WTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank]) && 'Date'[WeekDay]<=max('Date'[WeekDay])-1))
LWTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1 && 'Date'[WeekDay]<=max('Date'[WeekDay])-1 ))

 

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

@amitchandak

 

The first measure works, thanks!

 

I also added the week ranks and used the this week and last week measures. With those measure I was able to then create a measure to determine the % difference. Thank you!

 

Also the Youtube video you made is very informative!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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