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

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

Reply
kuehcj
Frequent Visitor

Max of one column but use result from a different column

I have a table like this:

SELCMC
7 Jul 19 D22270.86%12
7 Jul 19 DV278.18%28
7 Jul 19 DVS284.32%43
7 Jul 19 N22279.96%3
7 Jul 19 NV290.29%130
8 Jul 19 DV2 1

 

Of which I would like to get the MAX of MC, grouped by S and L. Here is the output that I would like to get:

 

SELC
7 Jul 19 DVS284.32%
7 Jul 19 NV290.29%
8 Jul 19 DV2 

 

May I know how can I achieve that with DAX?

1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi @kuehcj ,

If we want to use E as legend in a chart, we will need to use a calculated table rather than a measure, a measure cannot be used as a legend, Please refer to the following sample:

Table =
ADDCOLUMNS (
    SUMMARIZE ( Table1, Table1[S], Table1[L], "MC", MAX ( Table1[MC] ) ),
    "E", CALCULATE (
        MIN ( Table1[E] ),
        FILTER (
            ALL ( Table1 ),
            Table1[S] = EARLIER ( Table1[S] )
                && Table1[MC] = EARLIER ( [MC] )
        )
    ),
    "C", CALCULATE (
        MIN ( Table1[C] ),
        FILTER (
            ALL ( Table1 ),
            Table1[S] = EARLIER ( Table1[S] )
                && Table1[MC] = EARLIER ( [MC] )
        )
    )
)

We will get a table like below:

PBIDesktop_UbBctUEkJr.png

Then we can create the following visual:

PBIDesktop_Mw3MOL5boL.png

Best Regards,

Teige

View solution in original post

3 REPLIES 3
TeigeGao
Solution Sage
Solution Sage

Hi @kuehcj ,

If we want to use E as legend in a chart, we will need to use a calculated table rather than a measure, a measure cannot be used as a legend, Please refer to the following sample:

Table =
ADDCOLUMNS (
    SUMMARIZE ( Table1, Table1[S], Table1[L], "MC", MAX ( Table1[MC] ) ),
    "E", CALCULATE (
        MIN ( Table1[E] ),
        FILTER (
            ALL ( Table1 ),
            Table1[S] = EARLIER ( Table1[S] )
                && Table1[MC] = EARLIER ( [MC] )
        )
    ),
    "C", CALCULATE (
        MIN ( Table1[C] ),
        FILTER (
            ALL ( Table1 ),
            Table1[S] = EARLIER ( Table1[S] )
                && Table1[MC] = EARLIER ( [MC] )
        )
    )
)

We will get a table like below:

PBIDesktop_UbBctUEkJr.png

Then we can create the following visual:

PBIDesktop_Mw3MOL5boL.png

Best Regards,

Teige

Anonymous
Not applicable

Hi @kuehcj ,

 

I think below is what you want, please try:

Max of one column but use result from a different column.PNG

max E = CALCULATE(MAX(Table5[E]),FILTER(ALL(Table5[E],Table5[C],Table5[MC]),Table5[MC] = MAX(Table5[MC])))
max C = CALCULATE(MAX(Table5[C]),FILTER(ALL(Table5[E],Table5[C],Table5[MC]),Table5[MC] = MAX(Table5[MC])))
Measure = CALCULATE(MAX(Table5[MC]),ALL(Table5[E],Table5[C]))

Aiolos Zhao

Thanks a lot @Anonymous! That seems to work. Do you know if there is any way to use Max E as legend in a chart?

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.

Top Solution Authors