• 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

Diff between two columns|Power Pivot|Excel Forum|My Online Training Hub

You are here: Home / Diff between two columns|Power Pivot|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
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 ForumPower PivotDiff between two columns
sp_PrintTopic sp_TopicIcon
Diff between two columns
Avatar
MJ Thulasi
Member
Members
Level 0
Forum Posts: 33
Member Since:
November 27, 2020
sp_UserOfflineSmall Offline
1
October 10, 2021 - 9:18 pm
sp_Permalink sp_Print

Hi

I have created in a pivot table with monthly columns of amounts.

I select any two monthly columns by filter and I want to find the difference between the selected monthly columns

Rows       Apr 21    Jun 21

Sales        XXX        XXX

I want to find the diff between the above two columns.  The month can be any selected from column filter.

The DAX should give the diff whatever the column choses.  Thanks.

Rgds

Thulasi

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4515
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
October 11, 2021 - 9:36 am
sp_Permalink sp_Print

Hi Thulasi,

You can use the PREVIOUSMONTH function to calculate this. e.g.:

=SUM(Table1[Value])-CALCULATE(SUM(Table1[Value]), PREVIOUSMONTH(Table1[Date]))

 

If you're stuck, it's best to provide a small sample file so we can help you better.

Mynda

Avatar
MJ Thulasi
Member
Members
Level 0
Forum Posts: 33
Member Since:
November 27, 2020
sp_UserOfflineSmall Offline
3
October 11, 2021 - 10:21 pm
sp_Permalink sp_Print

Hi Mynda

Thank you for quick reply as always.

Your solution is perfect in giving the diff between two consecutive months.

Row        May 21       June 21       Diff  (consecutive months)

Sales         100            110            10

But it does not work for below case, if the two months are random period.

Row        Dec 20       June 21       Diff    (random months)

Sales         100            110            10

Also I may select some other fields like Categories instead of months.

Row         Cat A        Cat C           Diff (random fields)

Sales         100            110            10

Is it possible to create DAX for above requirement?  Eagerly waiting.  Thanks.

Rgds

Thulasi

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4515
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
October 12, 2021 - 9:56 am
sp_Permalink sp_Print

Hi Thulasi,

Perhaps this is what you're after.

Mynda

Avatar
MJ Thulasi
Member
Members
Level 0
Forum Posts: 33
Member Since:
November 27, 2020
sp_UserOfflineSmall Offline
5
October 13, 2021 - 4:20 pm
sp_Permalink sp_Print

Wow.....I think that's the issue I wanted to solve, Mynda.

Let me try to apply that DAX and comment back.

Thanks a ton.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 215
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Anthony van Riessen
Erlinda Eloriaga
Abisola Ogundele
MARTYN STERRY
Rahim Lakhani
Ngoc Qui Nguyen
Clement Mansfield
Rose .
Bindu Menon
Baruch Zemer
Forum Stats:
Groups: 3
Forums: 24
Topics: 6352
Posts: 27779

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • 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
 

Company

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

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.