Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I'd like to create a calculated column that show the decending ranking of the column name based on the column values as shown in the "Rank by Code" column.
I can resolve this case by using "SORTBY" and "CONCATNATE" function in excel but I don't know how to write the DAX formula to sort the column name in Power BI.
Would you please suggest the DAX formula to achieve this task?
Thanks!
Solved! Go to Solution.
Hi , @RitaP_123
It can be realized in Power Query Editor .
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can click "Custom Column" in "Add Column" tab:
(3)We can enter this M language:
Text.Combine(Table.Sort(Record.ToTable(_),{"Value",1})[Name])
(4)Then we can meet your need , the result is as follows:
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @RitaP_123
It can be realized in Power Query Editor .
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can click "Custom Column" in "Add Column" tab:
(3)We can enter this M language:
Text.Combine(Table.Sort(Record.ToTable(_),{"Value",1})[Name])
(4)Then we can meet your need , the result is as follows:
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@RitaP_123 Also, if you and an Index and then unpivot your A,B,C,D columns you can do this:
Rank by Code Measure = CONCATENATEX('Table2',[Attribute],,[Value],DESC)
PBIX is attached beneath signature that shows both ways.
@RitaP_123 Try:
Rank by Code Column =
VAR __Table = { ("A",[A]), ("B",[B]), ("C",[C]), ("D",[D]) }
RETURN
CONCATENATEX(__Table,[Value1],,[Value2],DESC)
User | Count |
---|---|
53 | |
28 | |
19 | |
18 | |
14 |
User | Count |
---|---|
92 | |
86 | |
39 | |
23 | |
22 |