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
Anonymous
Not applicable

Creating a Running Total by Date, Stacked Area Chart by Category

Hello - I'm trying to do something in Power BI that I can do fairly easily in excel and I was wondering if I am missing something.

 

I'm starting from a data table like this:

 

A.jpg

 

In Excel, i would then pivot the data as follows (with running totals):

 

B.JPG

 

And then create a pivot chart as follows:

 

C.JPG

 

I can't figure out how to do any of this in Power BI.


Any help would be MASSIVELY appreciated - thanks so much.

 

Adam

 

1 ACCEPTED SOLUTION

Hi,

You may download my revised PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you for the reply; however, the graph that is produced here is does not appear to be the same as the graph that I produced with the Pivot Chart.  The amounts do not appear to be stacked (i.e. the top amount on the y axis is not $50,450.  Is there any way to configure it the same way that I have it?

Hi,

You may download my revised PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, I found your solution and it is exactly what I'm needing. Although the measure to calucate the amount for all states is not working properly for me. For some reason it is adding a column with a blank header that sums the entire data table. I believe this is what is causing the mis calculation in my RT. Do you have any insight as to why this would be happening? Please see screenshot below

aejohnson04_0-1678198795508.png

 

Anonymous
Not applicable

Ashish -

 

Thank you so very much!!!  

 

You are awesome.  We've been trying to figure this out for a long time.

 

Best regards,


Adam

You are most welcome.  Thank you for your kind words.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Adam, Could you paste the sample data instead of a picture of sample data?

Connect on LinkedIn
Anonymous
Not applicable

See below - thanks!

 

DateTypeAmountState
1/1/2019Car1000PA
1/1/2019Truck2000WA
1/3/2019Car1500PA
1/5/2019Truck3000PA
1/7/2019Minivan2000CA
1/10/2019Car4500WA
1/10/2019Car1200PA
1/10/2019Car1500CA
1/12/2019Truck1000CA
1/15/2019Car2000WA
1/15/2019Minivan2500PA
1/20/2019Truck1500WA
1/20/2019Truck1700CA
1/21/2019Car2000PA
1/23/2019Truck4000PA
1/23/2019Car1200PA
1/25/2019Minivan2500WA
1/25/2019Car1000PA
1/29/2019Truck1200CA
1/29/2019Minivan1900CA
1/30/2019Minivan4000WA
1/30/2019Truck2500PA
1/30/2019Car2750WA
1/31/2019Truck2000CA

@Anonymous 

UPDATE:

I completely missed the running total. Use the DAX below to create the running total and use it in the graph instead of "Amount"

 

Replace the table and column names. Table - Data; Column - Date,Amount

 

Running Total =
VAR DATE1 =
    MAX ( Data[Date] )
RETURN
    CALCULATE (
        SUM ( Data[Amount] ),
        FILTER ( ALL ( Data[Date] ), Data[Date] <= DATE1 )
    )

 

 

 

Its easy in Power BI too. 

 

I used your sample data and created this graph. 

 

Cap11.PNG

 

Just connect to your data with excel as data source and select the sheet you want to load. Choose edit,Query editor window opens, click on the column header( Left side of each column -  where you see ABC,123) to select the correct datatypes in Query Editor.Close & Apply.

 

In the report window choose the graph i pointed out, drag and drop the attributes or measures in the highlighted area. 

 

To change the column format, open data window, choose the column and you could the format in the top ribbon.

 

If this helps, mark it as a solution,

Kudos are nice too.

Connect on LinkedIn

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.