Forum Discussion
naveen73
Aug 24, 2024Copper Contributor
Power Pivot running total without date column - NOT in Power BI
Hi all,
I am using Power Pivot in Excel and want to calculate the running total without Date column.
I found the following tutorial, which is for DAX in Power BI and tried to convert this to Excel Power Pivot but I am not able to do so.
Please can you help me converting this so that I can use it in Excel.
https://www.antmanbi.com/post/how-to-create-running-total-on-non-numeric-fields.
I am attaching a sample data table.
Running Total Brands =
VAR CurrentBrandSales =
[Total Sales]
VAR BrandsWithSales =
ADDCOLUMNS (
ALLSELECTED ( Products[Brand] ),
"@Sales", [Total Sales]
)
VAR BrandsWithHigherSales =
FILTER ( BrandsWithSales, [@Sales] >= CurrentBrandSales )
VAR Ranking =
-- Used only for confirming the ranking
COUNTROWS ( BrandsWithHigherSales )
VAR Result =
SUMX ( BrandsWithHigherSales, [@Sales] )
RETURN
Result
Thanks,
Naveen
1 Reply
- LorenzoSilver Contributor
Hi naveen73
Measure [Run_Total]:
= VAR CurrentBrandSales = MIN ( Products[Total Sales] ) VAR BrandsWithSales = ADDCOLUMNS ( ALLSELECTED ( Products ), "@Sales", Products[Total Sales] ) VAR BrandsWithHigherSales = FILTER ( BrandsWithSales, [@Sales] >= CurrentBrandSales ) RETURN SUMX ( BrandsWithHigherSales, [@Sales] )