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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anders_Dahl
Frequent Visitor

TOPN on rows

Hi friends,
Look in this table

IDValue1Value2Value3Reslut
1105115
220102040
330151747
440201860


I have tried to get the two highest values from Value1, Value2 and Value3 and Sum this in the Result for each row on that ID.
But i dont mangae to solve this.

Is there any out there who can help me.

1 ACCEPTED SOLUTION
amustafa
Super User
Super User

Hi @Anders_Dahl 

 

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/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Anders_Dahl
Frequent Visitor

@amustafa 
Thanks alot!
You made my day a little bit better 🙂

amustafa
Super User
Super User

Hi @Anders_Dahl 

 

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/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.