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
Jo_Chrq
Helper I
Helper I

Weekly variations in table and total

Hi all,

I'm having trouble creating a table in Power BI Desktop.

I have weekly sales for several stores and I would like to have a table (or matrix) with the weekly evolution.

 

Here's what I did :

 

 

 

Weekly Variation = 
VAR __PREV_WEEK = 
CALCULATE(
    SUM('table'[sales]),
    FILTER(
        ALL('table'), 'table'[week number] = MAX('table'[week number])-1
        )
)
VAR __MAX_WEEK = 
CALCULATE(
    SUM('table'[sales]),
    FILTER(
        ALL('table'), 'table'[week number] = MAX('table'[week number])
    )
)

RETURN 
DIVIDE( __MAX_WEEK - __PREV_WEEK, __PREV_WEEK)

 

 

 

 

But with this, I get the variation for the total in each row.

Here's what I get :

 

Stores        Sales week 1Sales week 2Variation week 1 - 2
Store 110€                   20€                    +13%                             
Store 210€-10€+13%
Store 310€15€+13%
Store 410€20€+13%
Total40€45€+13%

 

Here's what I would like to have :

Stores         Sales week 1Sales week 2Variation week 1 - 2
Store 110€                    20€                   +100%                            
Store 210€-10€-200%
Store 310€15€+50%
Store 410€20€+100%

Total

40€45€+13%

 

Many thanks in advance for your help

J.

1 ACCEPTED SOLUTION
Jo_Chrq
Helper I
Helper I

I just found the solution, which was actually quite simple.

I was using ALL so it ignored the stores (rows).

Should be ALLEXCEPT and exclude the the stores

 

Thanks anyway

J.

 

View solution in original post

3 REPLIES 3
Jo_Chrq
Helper I
Helper I

I just found the solution, which was actually quite simple.

I was using ALL so it ignored the stores (rows).

Should be ALLEXCEPT and exclude the the stores

 

Thanks anyway

J.

 

Hi @amitchandak 

Thank you for your reply. Unfortunately, I still have the same problem -> Each row gives me the total variation and not the variation for each store (each row)

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.