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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
pbi_m1
Frequent Visitor

Running Total

Hi

I have been going through 10+ 'Running Total' entries and haven't found a solution to this one yet, so excuse if this is already solved.

 

DATEPROD_IDVALUE
2-Jul-18A1113
3-Jul-18A1110
4-Jul-18A1112
5-Jul-18B2221
6-Jul-18B2220
9-Jul-18B2228

 
The difference to previous problems I looked at is that the date entries for some PROD_ID stop at a certain date and another PROD_ID will come in from then on e.g.I'd like to create the running total of the VALUE column of a table with the 3 columns: DATE, PROD_ID, VALUE

  

Based on this I would like the Running Total Matrix visualisation to be showing

DATEA111B222
2-Jul-1830
3-Jul-1830
4-Jul-1850
5-Jul-1851
6-Jul-1851
9-Jul-1859

 

However, at the moment I get (i.e. the Running Total for A111 stops on 4-Jul-2018)

DATEA111B222
2-Jul-1830
3-Jul-1830
4-Jul-1850
5-Jul-18 1
6-Jul-18 1
9-Jul-18 9

 

using the often mentioned measure formula + selecting PROD_ID in the 'Columns' section of the 'Matrix' visualisation:

 

RunningTotal = CALCULATE (
SUM ( Table[VALUE] ),
FILTER (
ALL ( Table[DATE] ),
Table[DATE] <= MAX ( Table[DATE] )
)
)

 

In order to get there in SQL Server I would CROSS JOIN the DATE & PROD_ID, then LEFT JOIN the VALUE column from the Table and use the SUM OVER PARTITION to create the Running Total.

 

I was wondering what the easiest way is to achieve this in Power BI?

1 ACCEPTED SOLUTION
pbi_m1
Frequent Visitor

Thanks Daniel. That's exactly solving it and way easier than CROSSJOIN.

View solution in original post

3 REPLIES 3
pbi_m1
Frequent Visitor

Thanks Daniel. That's exactly solving it and way easier than CROSSJOIN.

v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @pbi_m1,

Based on my test, you can refer to below steps:

1.I have entered some sample data to test for your problem like the picture below:

1.PNG

2.Create a new table and a new measure.

Table 2 = DISTINCT(Table1[PROD_ID])

Measure = CALCULATE(SUM('Table1'[VALUE]),FILTER(ALL('Table1'),'Table1'[DATE]<=MAX('Table1'[DATE])&&MAX('Table 2'[PROD_ID])='Table1'[PROD_ID]))

3.Create a Table visual and add the related columns, now you can see the result.

2.PNG

You can also download the PBIX file to have a view.

 https://www.dropbox.com/s/yitavv5yxuxt418/Running%20Total.pbix?dl=0

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
pbi_m1
Frequent Visitor

Hi @v-danhe-msft,

 

Thanks for the prompt reply. Could it be that you responded to a different submission. I wasn't necessarily interested in the total value by month.

 

My main question was how to extend a running total column down for all dates in a table beyond the last date enty of e.g. PROD_ID = 'A111'. I have been invetigating the CROSSJOIN and LOOKUPVALUE functions, however, there are seem to be a few ways to build it and I'm still looking for how to do it most efficiently given CROSSJOIN (VALUES(Table[DATE]), VALUES(Table[PROD_ID])) can create quit a large subtable. I also realised that I can't create any Relationships between the CROSSJOIN subtable and the Table. 

 

Any comments are welcome,

 

 

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.