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! Request now

Reply
Anonymous
Not applicable

Return max value if ID is the same - smallest value blank

Hi Experts

 

I want to only return back the max value if the ID's are the same and the value for the ID with the smallest value should be blank. The current measure is returning back max value for both ID's is they are the same....

 

my Measure

TWC =
VAR _Maxvalue = CALCULATE(MAX(QUOTEMAN[OPTTOTALCOST]), ALLEXCEPT(QUOTEMAN,QUOTEMAN[IMSTASKID]))
VAR _Result =      
        IF(QUOTEMAN[OPTNCHOICE] = 0,
        IF(_Maxvalue > 1000000, "VB3",
        IF(_Maxvalue >= 100000 && _Maxvalue <= 1000000 , "VB2B",
        IF(_Maxvalue >= 25000 && _Maxvalue <= 100000 , "VB2A","VB1"))))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _maxvalue=MAXX(FILTER(ALL('QUOTEMAN'),'QUOTEMAN'[IMSTASKID]=MAX('QUOTEMAN'[IMSTASKID])),[OPTTOTALCOST])
var _minvalue=MinX(FILTER(ALL('QUOTEMAN'),'QUOTEMAN'[IMSTASKID]=MAX('QUOTEMAN'[IMSTASKID])),[OPTTOTALCOST])
var _if=
IF(
    MAX('QUOTEMAN'[OPTNCHOICE])=0,
     IF(_maxvalue > 1000000, "VB3",
        IF(_maxvalue >= 100000 && _maxvalue <= 1000000 , "VB2B",
        IF(_maxvalue >= 25000 && _maxvalue <= 100000 , "VB2A","VB1"))))
return
IF(
    MAX('QUOTEMAN'[OPTTOTALCOST])=_maxvalue
    ,
    _if
    ,BLANK()
)

2. Result:

vyangliumsft_0-1663304422621.png

 

Best Regards,

Liu Yang

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _maxvalue=MAXX(FILTER(ALL('QUOTEMAN'),'QUOTEMAN'[IMSTASKID]=MAX('QUOTEMAN'[IMSTASKID])),[OPTTOTALCOST])
var _minvalue=MinX(FILTER(ALL('QUOTEMAN'),'QUOTEMAN'[IMSTASKID]=MAX('QUOTEMAN'[IMSTASKID])),[OPTTOTALCOST])
var _if=
IF(
    MAX('QUOTEMAN'[OPTNCHOICE])=0,
     IF(_maxvalue > 1000000, "VB3",
        IF(_maxvalue >= 100000 && _maxvalue <= 1000000 , "VB2B",
        IF(_maxvalue >= 25000 && _maxvalue <= 100000 , "VB2A","VB1"))))
return
IF(
    MAX('QUOTEMAN'[OPTTOTALCOST])=_maxvalue
    ,
    _if
    ,BLANK()
)

2. Result:

vyangliumsft_0-1663304422621.png

 

Best Regards,

Liu Yang

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

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.

Top Solution Authors