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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Net usage

I have a data slicer in my report and I want to create a measure that will subtract the value at end of the date filter from the value at the start data selected

 

for example if i set my date slicer to between 4-20 - 4-24 I want the value to show 40 (120-80)

 

Date    Value

4-20     120

4-21      110

4-22      100

4-23       90

4-24       80

 

Thank you!

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

hI @Anonymous ,

 

Try this measure:

 

Measure =
VAR _min = MINX(VALUES('Table'[Date]); 'Table'[Date])
VAR _max = MAXX(VALUES('Table'[Date]); 'Table'[Date])
RETURN
CALCULATE(SUM('Table'[Value]); FILTER(ALL('Table'[Date]); 'Table'[Date] = _min)) -
CALCULATE(SUM('Table'[Value]); FILTER(ALL('Table'[Date]); 'Table'[Date] = _max))
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

5 REPLIES 5
camargos88
Community Champion
Community Champion

hI @Anonymous ,

 

Try this measure:

 

Measure =
VAR _min = MINX(VALUES('Table'[Date]); 'Table'[Date])
VAR _max = MAXX(VALUES('Table'[Date]); 'Table'[Date])
RETURN
CALCULATE(SUM('Table'[Value]); FILTER(ALL('Table'[Date]); 'Table'[Date] = _min)) -
CALCULATE(SUM('Table'[Value]); FILTER(ALL('Table'[Date]); 'Table'[Date] = _max))
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

@camargos88 worked perfectly thank you!!

az38
Community Champion
Community Champion

Hi @Anonymous 

try a measure

Measure = 
var _minDate = MIN('Table'[Date])
var _maxDate = MAX('Table'[Date])
return 
MAXX(FILTER('Table','Table'[Date]=_maxDate),'Table'[Amount]) - 
MAXX(FILTER('Table','Table'[Date]=_minDate),'Table'[Amount])

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38 this makes sense but I am getting the incorrect output

amitchandak
Super User
Super User

@Anonymous , prefer to use a date calendar for dates

Try like

Measure =
var _min = minx('Date','Date'[Date])
var _max = maxx('Date','Date'[Date])
return
calculate(Table[Value],filter('Date','Date'[Date]=_min))- calculate(Table[Value],filter('Date','Date'[Date]=_max))

 

Or


Measure =
var _min = minx('Date','Date'[Date])
var _max = maxx('Date','Date'[Date])
return
calculate(Table[Value],filter(all('Date'),'Date'[Date]=_min))- calculate(Table[Value],filter(all('Date'),'Date'[Date]=_max))

 

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.