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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Making running total from pivoted data

 

Table.Pivot(Table.TransformColumnTypes(#"Filtered Rows2", {{"created", type text}}), List.Distinct(Table.TransformColumnTypes(#"Filtered Rows2", {{"created", type text}})[created]), "created", "userID", List.Count)

 

Would anyone be able to tell me how to make this pivoted table show a running total?

Currently it has the country of an entry in the rows and the date in the columns...

Country1/1/192/1/193/1/194/1/195/1/19
GB00010
NL11000
CA01200

I would like it to look like this...

 

Country1/1/192/1/193/1/194/1/195/1/19
GB00011
NL12222
CA01333

 

1 ACCEPTED SOLUTION
lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

You can download my proposed solution from here.

 

Here are the steps:

1) Unpivot the dates in Power Query to have a table as below

Countries unpivot columns.png

2) Add a measure for the cumulated value

Cumulated value = 
var selectedDate = LASTDATE('Countries'[Date])
RETURN
CALCULATE(SUM('Countries'[Value]), 'Countries'[Date]<=selectedDate, ALLEXCEPT('Countries',Countries[Country]))

Here is a screenshot of the final table:

Countries final table.png

 

Is this what you are looking for?

 

LC

Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com

 

 

View solution in original post

1 REPLY 1
lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

You can download my proposed solution from here.

 

Here are the steps:

1) Unpivot the dates in Power Query to have a table as below

Countries unpivot columns.png

2) Add a measure for the cumulated value

Cumulated value = 
var selectedDate = LASTDATE('Countries'[Date])
RETURN
CALCULATE(SUM('Countries'[Value]), 'Countries'[Date]<=selectedDate, ALLEXCEPT('Countries',Countries[Country]))

Here is a screenshot of the final table:

Countries final table.png

 

Is this what you are looking for?

 

LC

Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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