Forum Discussion
Anonymous
2 years agoNot applicable
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 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.
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])RETURNSUMX(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/
2 Replies
- amustafa
Solution Sage
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])RETURNSUMX(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/ - AnonymousNot applicable
amustafa
Thanks alot!
You made my day a little bit better 🙂