+ Reply to Thread
Results 1 to 7 of 7

How to calculate running total + total remaining in a pivot?

  1. #1
    Registered User
    Join Date
    11-02-2017
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    4

    How to calculate running total + total remaining in a pivot?

    Hello,

    First of all, thanks you all for the great stuff you write every day. So...

    I have this set of data:

    2vtrt36.jpg

    I've built a pivot table and I need a column after RT (remaining total) to show how much money there's available each month until the end of the year:

    15satjl.jpg

    Let's call that column "available yearly". This is how it would look like:

    For January: $50 (available) + $5060 (budget from Feb to Dec)= $6010
    For February: $50 (available) + $4610 (budget from March to Dec) = $4660

    I have to say that RT is calculated a the running total of "Spend", so I can't use it in calculated field.

    Any suggestions?

    Thanks!

    PS. Just in case anyone needs the workbook, here it is.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to calculate running total + total remaining in a pivot?

    This is what Power Pivot is great at.

    First of all, I would add a real date column to your source data, and add a date table to your workbook - then you can use the date / time functions of DAX.

    It's straightforward to build the measures you want:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then simply build your pivots as you want them.

    See attached workbook for a worked example.
    Attached Files Attached Files
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    11-02-2017
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    4

    Re: How to calculate running total + total remaining in a pivot?

    That's great! Thanks a million! I didn't even know what power pivots are. I'm learning a lot about it and will try to replicate your solution. Although my pivot table is pretty bigger than the one I used here and it needs some adjust.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to calculate running total + total remaining in a pivot?

    Glad it helped, and happy to have introduced you to Power Pivot!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You can also 'Add Reputation' to those who helped you. Thanks.

  5. #5
    Registered User
    Join Date
    11-02-2017
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    4

    Re: How to calculate running total + total remaining in a pivot?

    Sure thing! Thanks again. I'm still trying to replicate it with my set of data. I'll get back to you ASAP :-)

    By the way, there's something I don't fully understand. In your example, the Dates table shows values from 2015 to 2019, which is great. And your pivot only shows data for 2017 and 2018, which is right.

    But in my new set of data I get results in the pivot table for all years in Dates table, although I have only values for 2017 and 2018. Any ideas? Thanks!
    Last edited by Traste; 11-03-2017 at 07:51 AM.

  6. #6
    Registered User
    Join Date
    11-02-2017
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    4

    Re: How to calculate running total + total remaining in a pivot?

    I may have found the problem. It's a date format issue:

    2017-11-03 13_32_53-PowerPivot para Excel - Traste.xlsx.jpg

    I think I know how to fix it... hopefully!

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to calculate running total + total remaining in a pivot?

    Your date table should have ALL dates in it, between the earliest and latest dates you need, so that the DAX date functions work correctly. You'll see that the date table in the workbook I shared with you is generated by a function - you can easily generate a different date table, covering a different range of dates, and using different locale settings.

    Don't forget to define the date table as the "date" table in your power pivot model, and to create a relationship between the date field of the date table, and the date field of your fact table(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How do I calculate a running total
    By toddp2 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-21-2017, 03:57 AM
  2. [SOLVED] Calculate the total of a unique item and place in column G and make remaining items 0
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2015, 04:00 PM
  3. Replies: 1
    Last Post: 11-05-2015, 03:18 PM
  4. [SOLVED] Formula to calculate remaining vacation days from total
    By Tricia0923 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-09-2015, 10:17 PM
  5. Pivot Chart Running Total - Removing Current Year Future Total
    By car3489 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 07-27-2013, 03:35 AM
  6. Running Total of Days Remaining?
    By demonfly100 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-11-2012, 09:40 AM
  7. [SOLVED] % of Running Total to Grand Total in Pivot Table
    By David in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2005, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1