• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

PIVOT TABLE - GET DIFFERENCE FOR months as total of SUB TOTALS|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / PIVOT TABLE - GET DIFFERENCE FOR months as total of SUB TOTALS|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…PIVOT TABLE - GET DIFFERENCE FOR mo…
sp_PrintTopic sp_TopicIcon
PIVOT TABLE - GET DIFFERENCE FOR months as total of SUB TOTALS
Avatar
Syed Shah

New Member
Members
Level 0
Forum Posts: 2
Member Since:
June 26, 2023
sp_UserOfflineSmall Offline
1
July 7, 2023 - 2:31 pm
sp_Permalink sp_Print

i want to have a field to show

month on month difference 

feb-jan difference amount

mar-feb diff amount so on

 

excel file attached 

Avatar
Alan Sidman
Steamboat Springs, CO
Member
Members


Trusted Members
Level 0
Forum Posts: 174
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
2
July 8, 2023 - 2:11 am
sp_Permalink sp_Print

Here is a Power Query Solution

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Removed Other Columns" = Table.SelectColumns(Source,{"Bank", "Date", "Party", "DHS eqv"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Bank", type text}, {"Date", type date}, {"Party", type text}, {"DHS eqv", type number}}),
#"Inserted Month Name" = Table.AddColumn(#"Changed Type", "Month Name", each Date.MonthName([Date]), type text),
#"Inserted Year" = Table.AddColumn(#"Inserted Month Name", "Year", each Date.Year([Date]), Int64.Type),
#"Inserted Merged Column" = Table.AddColumn(#"Inserted Year", "MY", each Text.Combine({[Month Name], Text.From([Year], "en-US")}, ":"), type text),
#"Removed Columns" = Table.RemoveColumns(#"Inserted Merged Column",{"Date", "Month Name", "Year"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"MY", "Bank", "Party"}, {{"Total", each List.Sum([DHS eqv]), type nullable number}}),
#"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[MY]), "MY", "Total", List.Sum),
#"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"January:2023", "February:2023", "March:2023", "April:2023", "May:2023", "June:2023"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",null,0,Replacer.ReplaceValue,{"July:2023"}),
#"Inserted Subtraction" = Table.AddColumn(#"Replaced Value1", "Subtraction", each [#"February:2023"] - [#"January:2023"], type number),
#"Inserted Subtraction1" = Table.AddColumn(#"Inserted Subtraction", "Subtraction.1", each [#"March:2023"] - [#"February:2023"], type number),
#"Inserted Subtraction2" = Table.AddColumn(#"Inserted Subtraction1", "Subtraction.2", each [#"April:2023"] - [#"March:2023"], type number),
#"Inserted Subtraction3" = Table.AddColumn(#"Inserted Subtraction2", "Subtraction.3", each [#"May:2023"] - [#"April:2023"], type number),
#"Inserted Subtraction4" = Table.AddColumn(#"Inserted Subtraction3", "Subtraction.4", each [#"June:2023"] - [#"May:2023"], type number),
#"Inserted Subtraction5" = Table.AddColumn(#"Inserted Subtraction4", "Subtraction.5", each [#"July:2023"] - [#"June:2023"], type number),
#"Renamed Columns" = Table.RenameColumns(#"Inserted Subtraction5",{{"Subtraction", "Diff Feb:Jan"}, {"Subtraction.1", "Diff Mar:Feb"}, {"Subtraction.2", "Diff Apr:Mar"}, {"Subtraction.3", "Diff May:Apr"}, {"Subtraction.4", "Diff Jun:May"}, {"Subtraction.5", "Diff Jul:Jun"}}),
#"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"Bank"})
in
#"Removed Columns1"

Avatar
Riny van Eekelen
Örnsköldsvik, Sweden
Moderator
Members


Trusted Members

Moderators

Power BI
Level 1
Forum Posts: 605
Member Since:
January 31, 2022
sp_UserOfflineSmall Offline
3
July 8, 2023 - 4:55 pm
sp_Permalink sp_Print

I used your question to learn something new myself, so thank you!

You would really need to use Power Pivot and the Data Model for this. Inspired by what I found in the link below, I added a few pivot tables to your file. See if this is what you had in mind.

https://www.daxpatterns.com/mo.....culations/

Now, DAX measures aren't very straight-forward and can become very complicated. Personally, I find them hard to write from scratch if I'm dealing with something I haven't used before. But with the help of sites like in the link above you can fairly easily find a suitable pattern and adapt it to your specific needs.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Terry Hedditch, Charlotte Holloway, Tracy English, Mohamed Touahria
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
David von Kleek
Ronald White
Ginette Guevremont
Taryn Ambrosi
Mark Davenport
Christy Nichols
Harald Endres
Ashley Hughes
Herbie Key
Trevor Pindling
Forum Stats:
Groups: 3
Forums: 24
Topics: 6528
Posts: 28594

 

Member Stats:
Guest Posters: 49
Members: 32817
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.