Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How find a column name from MAX value

Hello Experts,

 

I need a dax formula to find the column name corresponding to the Measure which calculates Max value.

I have a Matrix visualization which displays All the max values, and the max value changes as per the team selected in slicer, the measures are from diffrentables, but shown under single matrix visual

M1Max value
M2MAX value
M3MAX value
M4MAXVALUE

ISSUE:I want a Dax formula to show the Max value of all the Teams and team name to be displayed in the matrix, the complexity is measure value and the teams are not directly related tables in the model, they are indirectly related(M-M) join

 

Maxvalue dax:var smry = SUMMARIZE('DIMTABLE','DIMTABLE'[D1],'DIMTABLE'[D2], "Measure Value", [FCT_TABLE_MSR])
return
maxx(smry, [Measure Value])

Present matrix in power bI:

 T1T2T3T4
M110208040
M2100200500150
M3250250250250

I need a dax to return the Maxvalue dax associated DIMTABLE'[D2], i tried calulate ,All, Allexcept with no luck.. can ypu please suggest?

O/P needed

     
M180T3  
M2500T3  
M3250T1,T2,T3,T4  
  • Hi, Anonymous 

     

    You can try like this:

    Measure =
    VAR maxvalue =
        MAXX ( FILTER ( ALL ( 'Table' ), [M] = SELECTEDVALUE ( 'Table'[M] ) ), [Value] )
    RETURN
        CONCATENATEX (
            FILTER (
                ALL ( 'Table' ),
                [M] = SELECTEDVALUE ( 'Table'[M] )
                    && [Value] = maxvalue
            ),
            [Attribute],
            ","
        )
    

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.
     
    Best Regards,
    Community Support Team _ Janey

3 Replies

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    amitchandak : due to data sensvity i cannot share the screenshots or PBI file

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

     

    You can try like this:

    Measure =
    VAR maxvalue =
        MAXX ( FILTER ( ALL ( 'Table' ), [M] = SELECTEDVALUE ( 'Table'[M] ) ), [Value] )
    RETURN
        CONCATENATEX (
            FILTER (
                ALL ( 'Table' ),
                [M] = SELECTEDVALUE ( 'Table'[M] )
                    && [Value] = maxvalue
            ),
            [Attribute],
            ","
        )
    

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.
     
    Best Regards,
    Community Support Team _ Janey