Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi Everyone,
I want to sort the data in a specific order. When I select a value in the slicer.
Below is the raw data:
Table :
Year | Month | Product | Amount |
2023 | 1 | AA | 100 |
2023 | 2 | BB | 200 |
2023 | 3 | CC | 100 |
2023 | 4 | DD | 100 |
2023 | 5 | EE | 300 |
2024 | 1 | AA | 300 |
2024 | 2 | CC | 500 |
2024 | 4 | DD | 600 |
2024 | 5 | ZZ | 300 |
2024 | 6 | BB | 300 |
slicer :
order Required
The order in which the products need to be sorted, when we select the year from slicer.
Solved! Go to Solution.
Try this ....
Create a "driver table" ...
Click on Sortkey and unpivot other columns
Rename atttubute to Year
Rename Value to Product
Change the datya types
Add a M:M Prodcut relationship to your data
Create 2 measures
Sorted product =
SELECTEDVALUE(driver[Product])
Sales =
CALCULATE(
SUM(yourdata[Amount]),
yourdata[Year] = SELECTEDVALUE(driver[Year]))
Add Matrix visual
Change the row text colour to white
and change the Rows filedname to a single space
to hide it
user the Driver year and not yourdate year in the slicer ... otherwise the solutoion will not work
Please click [accept solution] and the thumbs up button. Thank you
To sort data based on slicer selection in Excel:
Create Sorting Table: Map products to the required order for each year.
Add Helper Column: Example formula: =IF(A2=2023, VLOOKUP(B2, SortingTable!$A$1:$C$6, 2, FALSE),
VLOOKUP(B2, SortingTable!$A$1:$C$6, 3, FALSE))
Link Slicer: Connect the slicer to filter data by year.
Sort Data: Sort using the helper column.
Power BI
You description is a bit confussing.
Please provide example input data as table (not a screen print)
and the desire output
with a clear decsription
and omit any irreleant data and infomation.
you seem to be saying you want the data in C, E, B, D, A sequence instead of A, B, C, D, E
That is easy ...
just create a seperate table with 2 columns
Product | Sortkey |
C | 1 |
E | 2 |
B | 3 |
Then sort product by sortkey
learn how here
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column
Please click [accept solution] and [thumbs up]
The issue is that, for example, Product "AA" is present in both 2023 and 2024. I want Product "AA" to be displayed in one order for 2023 and a different order for 2024.
I have attached an image showing the required sort order for 2023 and 2024. As you can see, the sort order for product 's in 2023 is different from 2024.
Try this ....
Create a "driver table" ...
Click on Sortkey and unpivot other columns
Rename atttubute to Year
Rename Value to Product
Change the datya types
Add a M:M Prodcut relationship to your data
Create 2 measures
Sorted product =
SELECTEDVALUE(driver[Product])
Sales =
CALCULATE(
SUM(yourdata[Amount]),
yourdata[Year] = SELECTEDVALUE(driver[Year]))
Add Matrix visual
Change the row text colour to white
and change the Rows filedname to a single space
to hide it
user the Driver year and not yourdate year in the slicer ... otherwise the solutoion will not work
Please click [accept solution] and the thumbs up button. Thank you
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
15 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
12 | |
12 |