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
PradipMCT
Resolver II
Resolver II

Running total

Hello friends,

 

I am trying to calculate a running total based on orders table. 

 

I get wierd result. please check and help. i would like to get the running total based on category wise sales. 

 

here is the link to my powerbi file:

 

https://1drv.ms/u/s!ArDdiHvYfT0RgYwqe2eHCo64tUXfIg

 

Regards,

Pradip

4 ACCEPTED SOLUTIONS
Vvelarde
Community Champion
Community Champion

@PradipMCT

 

Hi, try with this:

 

 

Total sales running =
VAR TOT =
    CALCULATE ( SUM ( Orders[Sales] ) )
RETURN
    CALCULATE (
        [Total sales],
        FILTER ( ALLSELECTED ( 'Products2'[Sub category] ), [Total sales] <= TOT )
    )

 

Regards

 

Victor

Lima  Peru




Lima - Peru

View solution in original post

Hi Victor,

 

Thanks for the solution. It did work. Thanks again for that. just a simple question,

 

I am trying to understand that function when removed the variable syntax and tried to do without it doesnt work, could you kindly explain?Running total.PNG and why do we have to write calculate twice?

View solution in original post

@PradipMCT

 

The Var made a Calculate of Total Sales in this context. (Current Subcategory)

 

So The Filter Search all The  Subcategories with "Total-Sales"  Lower than the Total Sales of Actual Subcategory.

 

If you put directly in the filter its saying total Sales (Measure) are equal to Sum of Total Sales .

 

 




Lima - Peru

View solution in original post

Thanks Victor, 

 

That helps.

View solution in original post

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@PradipMCT

 

Hi, try with this:

 

 

Total sales running =
VAR TOT =
    CALCULATE ( SUM ( Orders[Sales] ) )
RETURN
    CALCULATE (
        [Total sales],
        FILTER ( ALLSELECTED ( 'Products2'[Sub category] ), [Total sales] <= TOT )
    )

 

Regards

 

Victor

Lima  Peru




Lima - Peru

Hi Victor,

 

Thanks for the solution. It did work. Thanks again for that. just a simple question,

 

I am trying to understand that function when removed the variable syntax and tried to do without it doesnt work, could you kindly explain?Running total.PNG and why do we have to write calculate twice?

@PradipMCT

 

The Var made a Calculate of Total Sales in this context. (Current Subcategory)

 

So The Filter Search all The  Subcategories with "Total-Sales"  Lower than the Total Sales of Actual Subcategory.

 

If you put directly in the filter its saying total Sales (Measure) are equal to Sum of Total Sales .

 

 




Lima - Peru

Thanks Victor, 

 

That helps.

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.