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

Running Total in Table Visual

I have a simple problem that I can't figure out.

The table below....the RT column is a simple running total that resets on change of vendor no.  The list will alway be sorted by Vendor No, and I need it is a table for the Export to Excel ....matrix won't export properly.  I ahve tried every which way....can someone please give me the DAX to make this happen...and is it a Calc Column or a Measure?

Thanks

 

Vendor NoInvoice AmountRT
1001100100
1002100100
1002100100
1003100100
1003100200
1003100300
1004100100
1004100100
5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

@martindoll 

Apologies upfront, but even though this can be calculated using DAX, if the final destination is Excel, why not do it in Excel itself by exporting the table as you have it and doing it there?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Well , ok, but the idea is for the user not not have to mess with the export.....it is meant to be dropped into review sheet.  That is what she is doing now, exporting data and creating formulas....

@martindoll - you need some other field in this table to work. Power BI doesn't understand rows like Excel does where you can reference rows above/below. An Invoice Number for example.

 

I added an Index to your data so it looks like below. Just go to the Add Columns ribbon in Power Query, then add an Index, but ideally you have some other mechanism (date, invoice number, etc) to do this with.

edhans_0-1602015418067.png

Then the following measure works:

Running Total =
VAR varCurrentIndex =
    MAX( Data[Index] )
RETURN
    CALCULATE(
        SUM( Data[Invoice Amount] ),
        Data[Index] <= varCurrentIndex,
        REMOVEFILTERS(
            Data[Index],
            Data[Invoice Amount]
        )
    )

It returns this:

edhans_1-1602015589332.png

I agree with @PaulDBrown on using Power BI here. If the goal is to get it into Excel, then do it in Excel. You can use Power Query there the same way and load this into the Power Pivot data model, add your measure there, and then the user simply refreshes their report.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Ok, great yes, I understand about Excel....I was trying to keep the process within Business Central...pin a PBI report on the Home Page.....but I'll go down that path....I had just talked to the end user about doing it within Excel.

Great @martindoll - right tool for the job. I prefer Power BI 99% of the time when DAX and Power Query are involved, but sometimes, Excel is the right place.

Other alternative is do it in Power BI then connect to Power BI from Excel using the Get Data/From Power BI menu option, which requires the user has a Power BI Pro license and have a pretty recent version of Excel. July 2020 or later I think...

edhans_0-1602019930037.png

Please mark one of these answers as the solution if we've helped so this thread can be marked as solved.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.