Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
I am using direct query of the table. need help on the custom sorting on the name and also count # of records where name = "High" (just for example)
The table has following columns.
Key | Name |
1 | High |
2 | High |
3 | High |
4 | Low |
5 | Low |
6 | Low |
7 | Low |
8 | Medium |
9 | Medium |
10 | Medium |
11 | High |
12 | Low |
13 | Medium
|
The output should be displayed as ( manual sort )
Name | Count |
High | 4 |
Medium | 4 |
Low | 5 |
How do I accomplish this using SWITCH ?
Solved! Go to Solution.
@Anonymous , Create a new column in Power Query and Then In Column Tools(DAX) mark it sort column=
=
If [Name] ="High" then 1
else if [Name] ="Medium" then 2 else 3
In case you want this DAX
Create a new column first
Name 1 = [Name]
Then create Sort column
Name Sort = Switch(True() ,
[Name] ="High" ,1,
[Name] ="Medium" ,2 ,3 )
Then mark Name Sort as sort column of Name 1 and use name 1 in visual
How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c
@Anonymous , Create a new column in Power Query and Then In Column Tools(DAX) mark it sort column=
=
If [Name] ="High" then 1
else if [Name] ="Medium" then 2 else 3
In case you want this DAX
Create a new column first
Name 1 = [Name]
Then create Sort column
Name Sort = Switch(True() ,
[Name] ="High" ,1,
[Name] ="Medium" ,2 ,3 )
Then mark Name Sort as sort column of Name 1 and use name 1 in visual
How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c
User | Count |
---|---|
11 | |
9 | |
6 | |
5 | |
4 |