+ Reply to Thread
Results 1 to 6 of 6

Including rates between column values in pivot chart

  1. #1
    Registered User
    Join Date
    01-08-2020
    Location
    Madrid, Spain
    MS-Off Ver
    2016
    Posts
    7

    Including rates between column values in pivot chart

    Hi!

    I have to produce a pivot table with years in columns, and I need to include a way of showing the rates of the values between the years shown in the table. Something like this on a simple example:

    TablesExample2.png

    Here the rate is calculated outside the table, but I can't use that because as soon as the filter on the years changes, the formulas for the rates stop working. Furthermore, I could need to dynamically add rate columns as the filter on the year shows more than two years, like on the second table here:

    TablesExample3.png

    I could try to do it with VBA, detect changes in the filters and change the formulas and add/remove/format columns accordingly, but the file is going to be distributed and I'm not sure if the policy at work allows for books with macros. Also, the column(s) would still be outside the table as such, although I could format it to look like it belonged, but that's not the point. I'm thinking DAX, but I'm a novice at DAX programming, so I'd appreciate any help. I don't know how to program a measure to grab the values of the shown year columns, I don't know how to show the rates as "independent" columns inside the table, and I don't know if it's even possible to increase/decrease the number of two-year rate columns as the number of years shown in the filter increase/decrease.

    I'm attaching the little example shown in the pictures, in case anyone wants to add anything to it.

    Many thanks in advance!

    Best,

    David
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Including rates between column values in pivot chart

    Perhaps the following will help.
    1. Drag Values into the values field again.
    2. In the field setting for the second instance of Value select Show values as > % Difference from > Year > (Previous) > OK
    Note that I changed the column header of the second instance to read: %Rate vs Previous Year
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    01-08-2020
    Location
    Madrid, Spain
    MS-Off Ver
    2016
    Posts
    7

    Re: Including rates between column values in pivot chart

    Quote Originally Posted by JeteMc View Post
    Perhaps the following will help.
    1. Drag Values into the values field again.
    2. In the field setting for the second instance of Value select Show values as > % Difference from > Year > (Previous) > OK
    Note that I changed the column header of the second instance to read: %Rate vs Previous Year
    Let us know if you have any questions.
    Hi!

    Thanks for the help. It's a good idea to start with. It's basically what I need, but I'd still like some way of doing it with DAX measure to add flexibility. Besides, I see some strange behaviour that I can't understand. In the example file I attached it works fine, but my real file is more complicated. For example, if in the example file you put the field "Colour" in columns, below the year, and include year subtotals you will see this -in red:

    TablesExample6.png

    ...which is wrong, because the field is empty but when you collapse the year field, the outcome is now right:

    TablesExample7.png

    Why is that happening? Isn't there a way to see the % with the year field expanded? And again, any suggestion about the use of DAX?

    Thanks again!

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Including rates between column values in pivot chart

    In the attached update a column (Date) is added to the Data Model using: =DATE(tblProduct[Year],1,1)
    The explicit measure that calculates the percentage difference is: % Difference of Value:=IFERROR((SUM([Value])-CALCULATE(SUM([Value]),PREVIOUSYEAR(tblProduct[Date])))/CALCULATE(SUM([Value]),PREVIOUSYEAR(tblProduct[Date])),"")
    The resulting pivot table is on Sheet2.
    Let us know if you have any questions.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-08-2020
    Location
    Madrid, Spain
    MS-Off Ver
    2016
    Posts
    7

    Re: Including rates between column values in pivot chart

    Quote Originally Posted by JeteMc View Post
    In the attached update a column (Date) is added to the Data Model using: =DATE(tblProduct[Year],1,1)
    The explicit measure that calculates the percentage difference is: % Difference of Value:=IFERROR((SUM([Value])-CALCULATE(SUM([Value]),PREVIOUSYEAR(tblProduct[Date])))/CALCULATE(SUM([Value]),PREVIOUSYEAR(tblProduct[Date])),"")
    The resulting pivot table is on Sheet2.
    Let us know if you have any questions.
    Thanks! That does it, and, more importantly, serves me as a starting point to build more complex measures in my real data. Closing thread!

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Including rates between column values in pivot chart

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. Pivot chart not including all data
    By buhaj47 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-10-2019, 11:24 AM
  2. Including rows with no data in a pivot chart
    By miro2021 in forum Excel General
    Replies: 1
    Last Post: 11-11-2018, 07:59 PM
  3. [SOLVED] Excluding fields and including totals from pivot chart
    By benalt613 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 10-24-2018, 12:40 PM
  4. Need formula for calculating daily labor rates including overtime.
    By Evilemonade in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-16-2017, 03:10 AM
  5. Replies: 2
    Last Post: 03-28-2014, 02:01 PM
  6. [SOLVED] Pivot Chart - Want to filter a column with multiple values
    By Rudurk in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-23-2013, 09:45 AM
  7. Pivot tables (Values including symbols show as '0')
    By DONA7377 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-09-2013, 07:26 AM

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