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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

MIn and Max dates in selection

Hi, community,

 

I am trying to calculate the difference between the biggest and lowest values in this table in the selected range of dates. 

almafater2_0-1625044305833.png

 

In this case the the desired result would be a dax measure that would calculate:

VerteX on lowest date in selection (31320000)  - VerteX on the biggest date on selection (27380000) = 3940000. 

 

How do I identify the min and max dates in the selection? 

 

The formula for VNT VertėX =

CALCULATE(

SUMX('VNT Vertės', 'VNT Vertės'[InvestmentUnitValueEntEY.Unit_Value] * [VNT Skaičius]),
FILTER(ALL(Dates[Date]), Dates[Date] <= MAX(Dates[Date])))
 
Ataching link with PBI file example:
 
1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can use the following measure:

 

Measure = FIRSTNONBLANKVALUE(Dates[EndOfMonth],[VNT VertėX])-LASTNONBLANKVALUE(Dates[EndOfMonth],[VNT VertėX])

 

Capture51.PNG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can use the following measure:

 

Measure = FIRSTNONBLANKVALUE(Dates[EndOfMonth],[VNT VertėX])-LASTNONBLANKVALUE(Dates[EndOfMonth],[VNT VertėX])

 

Capture51.PNG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@Anonymous , try a measure like

 

measure =
var _max = MAXX(allselected('Dates'), 'Dates'[Date])
var _min = MAXX(allselected('Dates'), 'Dates'[Date])
return
CALCULATE(
SUMX('VNT Vertės', 'VNT Vertės'[InvestmentUnitValueEntEY.Unit_Value] * [VNT Skaičius]),
FILTER((Dates[Date]), Dates[Date] = _max)) - CALCULATE(
SUMX('VNT Vertės', 'VNT Vertės'[InvestmentUnitValueEntEY.Unit_Value] * [VNT Skaičius]),
FILTER((Dates[Date]), Dates[Date] = _min))

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.