Reputation: 197
I have a table with column that have products and count of products. I want to set the products with values so that when i sort the products on PowerBI they should appear in a certain order. For Example, I have 3 products, ADSL, Data, and Broadband. When you sort them out alphabetically they appear as ADSL, Broadband and Data. However I would like to sort them out in this Order Broadband, Data, ADSL. I know you have to use a CASE statement and I tried using it but it didnt work hence I am here. Please assist.
Upvotes: 1
Views: 249
Reputation: 133370
a simple way is the use of case when in order by in this way ..
select your_column1, your_column2, your_column3
from your_table
ORDER BY CASE your_column
WHEN 'Broadband' THEN 1
WHEN 'Data' THEN 2
WHEN 'ADSL' THEN 3
ELSE 4
END
Upvotes: 1