Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
powerbiuser711
New Member

Calculate Difference Between 2 Values Same Column - Based on Date Filters

Hi all,

 

Relatively new Power BI user here.  I have one column that has account $ values and another column that has dates.  When I bring the data into a matrix table I can filter the columns by particular dates and have rows by sales rep, but now I would like to calculate the difference in $ amounts and calculate the % difference between any 2 dates that I select.  I know how to do this in Excel, but am completely unsure how to approach this in Power BI.

 

For example,

 

            03/26/20           04/02/20           Difference         % Difference

John    $1,987,123        $2,345,961               ?                    ?

Steve   $3,987,123         $5,345,961              ?                    ?

 

 

Thanks for your help!

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@powerbiuser711 

Assumed you have joined with a date dimension and want to slicer min and max date. For static change the variable(Var) values

difference =
var _max = maxx('Date','Date'[Date])
var _min = Minx('Date','Date'[Date])

return
CALCULATE(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_max)) -CALCULATE(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_min))



difference =
var _max = maxx('Date','Date'[Date])
var _min = Minx('Date','Date'[Date])

return
divide(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_max)) ,CALCULATE(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_min))) -1

 

In case you need two slicer, refer to my blog :https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@powerbiuser711 

Assumed you have joined with a date dimension and want to slicer min and max date. For static change the variable(Var) values

difference =
var _max = maxx('Date','Date'[Date])
var _min = Minx('Date','Date'[Date])

return
CALCULATE(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_max)) -CALCULATE(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_min))



difference =
var _max = maxx('Date','Date'[Date])
var _min = Minx('Date','Date'[Date])

return
divide(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_max)) ,CALCULATE(SUM(Table[values ]), FILTER(all('Date'), 'Date'[Date] =_min))) -1

 

In case you need two slicer, refer to my blog :https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Ashish_Mathur
Super User
Super User

Hi,

Please clarify/share the following:

  1. Will you always only select 2 dates?
  2. Will the 2 selected dates always be continuous?
  3. Share data in format that can be pasted in MS Excel.

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.