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
BhavyaM
Helper V
Helper V

How to display values for only Latest ID

I have to show Maximum value and Max-1 value based on ID, 

I dont have date column 

BhavyaM_1-1608555107635.png

Max column should show values only for Max id and Max-1 rows should show as Blank()

Min column should show values only for Max-1 id and Max rows should show as Blank()

 

Max =
Var a = CALCULATE(SUM('A'[VALUE]),FILTER('A','A'[ID] = MAX('A'[ID])))
Return
SWITCH(TRUE(),
a=0.00,0.00,
a>0,a,""
)
 
Min =
Var a = CALCULATE(SUM('A'[VALUE]),FILTER('A','A'[ID] = Min('A'[ID])))
Return
SWITCH(TRUE(),
a=0.00,0.00,
a>0,a,""
)
 
but i am not getting as expected
 
Please provide me solution
 
Thanks in advance
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @BhavyaM 

If there is any other column in your table to identify each row of data?

Based on the information you currently provide, I have modified your original  measure  as below:

Max1 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'A'[ID] ) = MAXX ( ALL ( A ), A[ID] ), SELECTEDVALUE ( A[VALUE] ),
    SELECTEDVALUE ( 'A'[ID] ) = MINX ( ALL ( A ), A[ID] ), BLANK ()
)
Min1 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'A'[ID] ) = MAXX ( ALL ( A ), A[ID] ), BLANK (),
    SELECTEDVALUE ( 'A'[ID] ) = MINX ( ALL ( A ), A[ID] ), SELECTEDVALUE ( A[VALUE] )
)

7.png

 

Please check my sample file for more details.

If it doen't meet your requirement,please let me know.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @BhavyaM 

If there is any other column in your table to identify each row of data?

Based on the information you currently provide, I have modified your original  measure  as below:

Max1 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'A'[ID] ) = MAXX ( ALL ( A ), A[ID] ), SELECTEDVALUE ( A[VALUE] ),
    SELECTEDVALUE ( 'A'[ID] ) = MINX ( ALL ( A ), A[ID] ), BLANK ()
)
Min1 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'A'[ID] ) = MAXX ( ALL ( A ), A[ID] ), BLANK (),
    SELECTEDVALUE ( 'A'[ID] ) = MINX ( ALL ( A ), A[ID] ), SELECTEDVALUE ( A[VALUE] )
)

7.png

 

Please check my sample file for more details.

If it doen't meet your requirement,please let me know.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@BhavyaM , All values are same, How will min and max be different ?

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

I am considering Latest and Latest-1 ID and calculating it value. 

IDVALUECurrent ID ValuePrevious ID Value
20201217131254.391254.391254.39
20201217131254.391254.391254.39
20201217131254.391254.391254.39
20201217131254.391254.391254.39
20201217130.3320.3320.332
20201217130.3320.3320.332
20201217130.3320.3320.332
20201217130.3320.3320.332
20201217130.3320.3320.332
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617000
2020121617276.955276.955276.955
20201216173442.633442.633442.63
2020121617258.491258.491258.491
20201216173442.633442.633442.63
20201216173442.633442.633442.63
20201216173442.633442.633442.63
20201216173442.633442.633442.63
20201216170.9160.9160.916
20201216170.9160.9160.916
20201216170.9160.9160.916
20201216170.9160.9160.916
20201216170.9160.9160.916
2020121617000

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.