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
jlankford
Advocate I
Advocate I

Need to find % change, week to week

Hello, 

 

I have a large dataset from a large retailer I'll call "World Mart." I need to calculate the week-to-week difference (% Change). 

 

The data provides everything you see below (and then some). 

 

I need to be able to compare one walmart week with the previous one. Unfortunately, I'm stuck, as I'm having difficulty summing the days into weeks while also sticking EXACTLY to that item and store. 

 

I can create date tables, and I have already made a custom column with the WM Week - 1 (to show previous week. 

 

I need to be able to show the % change, week by week. 

 

If someone could point me to a way where I can do this, I'd be appreciative. Even if you can get me to the point where I can create a shifted column called "POS SALES US DOLLARS LAST WEEK" I'd be happy. 

 

Thank you

 

image.png

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @jlankford,

 

I assume your information has all the weeks in the year try something like:

 

PW =
VAR previous_week =
    MAX ( 'Fact'[WM Week] )
RETURN
    DIVIDE (
        CALCULATE ( SUM ( 'Fact'[POS] ); 'Fact'[WM Week] = previous_week - 1 )
            - SUM ( 'Fact'[POS] );
        SUM ( 'Fact'[POS] )
    )

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @jlankford,

 

I assume your information has all the weeks in the year try something like:

 

PW =
VAR previous_week =
    MAX ( 'Fact'[WM Week] )
RETURN
    DIVIDE (
        CALCULATE ( SUM ( 'Fact'[POS] ); 'Fact'[WM Week] = previous_week - 1 )
            - SUM ( 'Fact'[POS] );
        SUM ( 'Fact'[POS] )
    )

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi MFelix, 


Thank you very much! That worked. As it turns out, I was very close, but I was confusing a few columns (we have these columns in several currencies).  I'm embarrassed that the solution was so simple. 

 

I appreciate the help, and I'm discovering that after nearly a year of working with DAX and M, I'm learning a lot of valuable ways to look at data. 

 

All the best!

 

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.