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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Sapiec
Frequent Visitor

Week over Week comparison by country

Hi All,

 

I have a weekly sales measure and a Week on Week measure that calculates the change of sales over week under the same table.

On a total sales aspect it works fine.

When I add the Country it takes sales of week 2 for the specific country and subtracts it from total sales of week 1.

So for UK&I it takes week 2 sales 115784 and subtracts from total group sales of week one, 2,501,074.

 

What do I have to change to obtain weekly difference by country? 

 

 

 

Sapiec_0-1643294375324.png

Many thanks

 

5 REPLIES 5
VahidDM
Super User
Super User

Hi @Sapiec 

 

Check this post: https://www.vahiddm.com/post/weekly-time-intelligence-dax

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

ValtteriN
Super User
Super User

Hi,

I recommend cheking this post about a similar topic:
 https://community.powerbi.com/t5/Desktop/Week-over-Week-Change/m-p/243318


The Week over week calculations presented there should solve your issue.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@Sapiec , For that, is better to have a separate date/week table with week rank on year week. In same table all will remove other filter from the context 

new column

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

 

measures
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))

 

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

 

Hi @amitchandak Thanks for the info provided. Unfortunately the Last Week/ This Week measures add up ALL of the sales as per screenshot below:

Sapiec_0-1643386838921.png

In my original script I do use remove filters[nvoice Date] and in the SUMX of Sales and i do get correct weekly sales. It is the delta between week one and week two that does not work.

Happy to share a sample so you have a clearer picture.

The week Rank though seems to work correctly:

 

Sapiec_1-1643386887460.png

 

 

Anonymous
Not applicable

hi.there you need to calculate week ranks insted of week measure but i am not sure

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors