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
nathannn
Regular Visitor

Running totals filling in blanks with previous month

I have the following table showing the running total of a balance for each period (month)

 

The sum of the running total has been done within the query, however we have some fields that have no value

 

This is affecting the grand totals of the cumulative table, how am I able to configure the visual to display the previous total if no value is populated for that month?  

 

 

Thanks.RunningTotal.png

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @nathannn 

You can use sumx to build a cumlative total measure.

I build a sample table to have a test.

1.png

Your values may be a measure:

 

M.Value = SUM('Table'[Value])

 

Cumlative total measure:

 

Measure = 
Var _Cumlativetotal = SUMX(FILTER(ALL('Table'),'Table'[NomianlGroupType]=MAX('Table'[NomianlGroupType])&&'Table'[Period]=MAX('Table'[Period])&&'Table'[Category]<=MAX('Table'[Category])),[M.Value])
Var _Value = IF(ISBLANK(_Cumlativetotal),0,_Cumlativetotal)
Return
IF(HASONEVALUE('Table'[NomianlGroupType]),_Value,SUMX(FILTER('Table','Table'[Period]=MAX('Table'[Period])),[M.Value]))

 

Result:

2.png

Left visual is a normal sum visual like yours and the right one is a running total visual by GroupType and Category.


You can download the pbix file from this link: Running totals filling in blanks with previous month

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @nathannn 

You can use sumx to build a cumlative total measure.

I build a sample table to have a test.

1.png

Your values may be a measure:

 

M.Value = SUM('Table'[Value])

 

Cumlative total measure:

 

Measure = 
Var _Cumlativetotal = SUMX(FILTER(ALL('Table'),'Table'[NomianlGroupType]=MAX('Table'[NomianlGroupType])&&'Table'[Period]=MAX('Table'[Period])&&'Table'[Category]<=MAX('Table'[Category])),[M.Value])
Var _Value = IF(ISBLANK(_Cumlativetotal),0,_Cumlativetotal)
Return
IF(HASONEVALUE('Table'[NomianlGroupType]),_Value,SUMX(FILTER('Table','Table'[Period]=MAX('Table'[Period])),[M.Value]))

 

Result:

2.png

Left visual is a normal sum visual like yours and the right one is a running total visual by GroupType and Category.


You can download the pbix file from this link: Running totals filling in blanks with previous month

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Fowmy
Super User
Super User

@nathannn 

Can you share the measure in the calculation to check?


________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy Thanks for your response! 
 
The measure is just a simple sum formatted to put () round the negative values. 
The running total has been done in SQL. Is there a better alternative within PBI?

@nathannn 

 

To create financial statements in Power BI and to make use of all the amazing functionalities, you should bring in only the GL amount and so all other calculations within POWER BI. 

Your running balance will not respond to slicers and filtering in many cases as it from the source data. 

 

Search on YouTube for Power BI Financial reports, you will get good videos to follow. 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.