Forum Discussion
Nissa23
Helper I
3 years agoTop N by row (dates) from multiples columns
Hi,
I'd like to do a visual showing only Top (N) using multiples columns.
| dates | Col1 | col2 | col3 | col4 | Wanted Result in visual | |
| 2023-04-20 | 25 | 20 | 15 | 45 | col1 :25; col4: 45 | |
| 2023-04-21 | 12 | 35 | 10 | 34 | col4: 34; col2: 35 | |
| 2023-04-22 | 45 | 22 | 36 | 48 | 45;48 | |
| 2023-04-23 | 12 | 47 | 31 | 14 | 47;31 | |
| 2023-04-24 | 56 | 20 | 33 | 12 | 56;33 |
I'm using the filter but I can just choose one column not all others :
Do you have idea how to do it ?
Thanks
Nissa
Hi Nissa23 ,
Please try:
First Unpivot your data:
Output:
Then apply the measure:
TOPN_Value = var _a = TOPN(2,FILTER(ALL('Table'),'Table'[dates]=SELECTEDVALUE('Table'[dates])),[Value],DESC) return IF(SELECTEDVALUE('Table'[Attribute]) in SELECTCOLUMNS(_a,"Attribute",[Attribute]),SUM('Table'[Value]))Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-jianboli-msft
Community Support
Hi Nissa23 ,
Please try:
First Unpivot your data:
Output:
Then apply the measure:
TOPN_Value = var _a = TOPN(2,FILTER(ALL('Table'),'Table'[dates]=SELECTEDVALUE('Table'[dates])),[Value],DESC) return IF(SELECTEDVALUE('Table'[Attribute]) in SELECTCOLUMNS(_a,"Attribute",[Attribute]),SUM('Table'[Value]))Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.