Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

TOPN on rows

Hi friends, Look in this table ID Value1 Value2 Value3 Reslut 1 10 5 1 15 2 20 10 20 40 3 30 15 17 47 4 40 20 18 60 I have tried to get the two highest valu...
  • amustafa's avatar
    2 years ago

    Hi Anonymous 

     

    You need to create a new colunm (not measure) in your table. See sample DAX. 

    TopNSum =
    VAR v1 = 'Table'[Value1]
    VAR v2 = 'Table'[Value2]
    VAR v3 = 'Table'[Value3]
    VAR SortedValues =
        TOPN(2, {v1, v2, v3}, [Value])
    RETURN
        SUMX(SortedValues, [Value])
     
    If I answered your question, please mark this thread as accepted.
    Follow me on LinkedIn:
    https://www.linkedin.com/in/mustafa-ali-70133451/