+ Reply to Thread
Results 1 to 13 of 13

Pivot / Power Pivot - Year To Date Column

  1. #1
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Pivot / Power Pivot - Year To Date Column

    Hello,
    Is there a way to add a Year-to-date column to a pivot table that list sales for specific customers in a specific months. The main filter is for Month-Year, but I need to add a Year-to-date column that will recalculate the total sales: if I filter for February sales, the YTD column should show the sum of sales for Jan and Feb, if I filter for November, the YTD column should display the sum of 11 months, Jan to Nov. Will Power Pivot/DAX expressions t be more helpful? The result should look like this

    Sum of Quantity
    Customer Group/Item Category 2018-11 Grand Total
    Cummins D/S - 1 3
    DTNA D/S - 0 33
    Independent - 38 595
    Mack D/S - 1 46
    Grand Total 40 677

    Thank you
    Last edited by Ballet4ever; 04-28-2019 at 01:42 AM.

  2. #2
    Forum Contributor
    Join Date
    01-09-2016
    Location
    Perth Western Australia
    MS-Off Ver
    Office 365
    Posts
    257

    Re: Pivot / Power Pivot - Year To Date Column

    Hi

    Can you please upload a sample file (desensitized) as it will make finding aworkable solution easier.

    Thank you

  3. #3
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot / Power Pivot - Year To Date Column

    Here it is. I need the Year-to-Date column to display sum of quantity depending on Year-Month filter: if Year-Month filter is 2018-11, I need a total for the first 11 months of 2018, if the Year-Month filter is 2017-03, I need the YTD total to display the sum of q-ty for the first 3 month of 2017.
    Thank you.
    Attached Files Attached Files
    Last edited by Ballet4ever; 04-28-2019 at 02:05 AM.

  4. #4
    Forum Contributor
    Join Date
    01-09-2016
    Location
    Perth Western Australia
    MS-Off Ver
    Office 365
    Posts
    257

    Re: Pivot / Power Pivot - Year To Date Column

    Hi

    Does this help.

    I have added 2 more filters. You need to change these in the top window when you click on the pivot table.
    If you need further please reply and I will try for you.

    Cheers
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot / Power Pivot - Year To Date Column

    Thank you for trying to help, FoxSeeLady. I need to have TWO columns for quantity data: one of the chosen month and another one for the current year to date. In your file, I only see ONE column displaying YTD quantity for first 10 months of year 2017. I need a column showing the total for October 2017 in this case.
    thank you

  6. #6
    Valued Forum Contributor
    Join Date
    09-25-2015
    Location
    Nowy Tomysl, Poland
    MS-Off Ver
    2019, O365
    Posts
    398

    Re: Pivot / Power Pivot - Year To Date Column

    Hello,
    The effect you want to achieve requires using Power Pivot and the data model. I added a calendar of dates and correlated it with your data source.
    I gave the measure YTDQta. In the filters I gave YYMM from the calendar.
    Regards
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot / Power Pivot - Year To Date Column

    dziękuję, stasinek! brilliant!
    Did you have to create a separate calendar table to make =TOTALYTD([Total Quantity],DATESYTD('Calendar'[Date])) measure work with a different set of dates than Total Quantity:=SUM(Table1[Quantity]) measure?

  8. #8
    Valued Forum Contributor
    Join Date
    09-25-2015
    Location
    Nowy Tomysl, Poland
    MS-Off Ver
    2019, O365
    Posts
    398

    Re: Pivot / Power Pivot - Year To Date Column

    One good practice for this kind of calculation is to create a calendar table with non repetive dates and with month, year, quarter,... columns and then create a relationship between the calendar and the Sales date then use the columns in the calendar to make the axis/main columns in your visuals that way the measures will work ad expectef.
    Otherwise, the calculations will be incorrect.

  9. #9
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot / Power Pivot - Year To Date Column

    Hello stasinek, when I try to recreate the DAX expressions in my file, the YTD Q-ty Comes up blank (see screenshots). My file is too big to upload, plus there is sensitive info in it. Do you know what could be wrong?
    Attached Images Attached Images

  10. #10
    Valued Forum Contributor
    Join Date
    09-25-2015
    Location
    Nowy Tomysl, Poland
    MS-Off Ver
    2019, O365
    Posts
    398

    Re: Pivot / Power Pivot - Year To Date Column

    Distort data and send a data source slice (3 tables). It looks good from the screenshots - we'll see where the error is.

  11. #11
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot / Power Pivot - Year To Date Column

    I am pretty sure there is something wrong with my calendar. How did you create yours? I copied the date from the source data into a separate spreadsheet, removed duplicates, added to data model, changed data type to date/marked as a date table and created the relationship with the source data table.
    Then I tried a different method: created one from scratch by filling out workday series from the first day to the last. This calendar did not work either.
    Attached is the same sample file where I tried to recreate your steps. Could you please have a look?

    Thank you.
    Attached Files Attached Files
    Last edited by Ballet4ever; 04-30-2019 at 12:13 AM.

  12. #12
    Valued Forum Contributor
    Join Date
    09-25-2015
    Location
    Nowy Tomysl, Poland
    MS-Off Ver
    2019, O365
    Posts
    398

    Re: Pivot / Power Pivot - Year To Date Column

    Everything works. Just as I silently thought - your date format is wrong. Correct them and everything will return to normal.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot / Power Pivot - Year To Date Column

    Many tanks, stasinek, for your help and advice. Something is not working quite right. The first and second version have different totals(see the screenshot.) The totals should be the same. My sneaking suspicion is my calendar. I will redo it in Power Query ans see if it is better. Thanks for your help, again.
    Attached Images Attached Images

+ 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] Power Pivot does not load new column added in Power query
    By ibuhary in forum Excel General
    Replies: 12
    Last Post: 02-19-2019, 03:53 AM
  2. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  3. Power pivot calendar fiscal year calcualtions
    By Melissalee71 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-07-2018, 09:24 PM
  4. Power pivot relationship for date not working
    By AliAB in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 07-22-2017, 05:07 PM
  5. Date fields in power pivot
    By stephme55 in forum Excel General
    Replies: 1
    Last Post: 09-03-2016, 01:34 AM
  6. Date formats in pivot tables using power pivot in Excel 2010.
    By myobreportguru in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-25-2013, 10:21 PM
  7. Power Pivot with multiple pivot charts using different pivot data
    By Paul-NYS in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-10-2013, 10:18 AM

Tags for this Thread

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