Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kovacikm78
Frequent Visitor

Order a column by using slicer selection from another table

Hi guys, can somebody help me with this issue?
I need to order product type based on slicer selection channel from another table.
If I choose eshop, I want my product type order by column index eshop.
If I choose B&M, I wan my product type order by column index B&M.
I tried to add new column, but it is not working:
DynamicSortIndex =
IF(
SELECTEDVALUE(FACT_Sales[Channels]) = "B&M",
DIM_Product[Index B&M],
DIM_Product[Index eshop])

my tables: FACT_Sales[Channels]

kovacikm78_0-1727509725379.png

DIM_Product[Index B&M]

kovacikm78_1-1727509742662.png

 

kovacikm78_2-1727509830624.png

link to download sample file pbix.


thank you for your help

 

 



1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @kovacikm78 

 

Add a measure to your model using the following DAX:

DynamicSortIndex = 
VAR SelectedChannel = SELECTEDVALUE(FACT_Sales[Channels])
RETURN
SWITCH(
    TRUE(),
    SelectedChannel = "B&M", MAX(DIM_Product[Index B&M]),
    SelectedChannel = "eshop", MAX(DIM_Product[Index eshop]),
    MAX(DIM_Product[Index B&M]) -- Default or when no selection is made
)

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

 

LinkedIn|Twitter|Blog |YouTube 

View solution in original post

2 REPLIES 2
kovacikm78
Frequent Visitor

Thank you very much for nice workaroud. Working like a charm

VahidDM
Super User
Super User

Hi @kovacikm78 

 

Add a measure to your model using the following DAX:

DynamicSortIndex = 
VAR SelectedChannel = SELECTEDVALUE(FACT_Sales[Channels])
RETURN
SWITCH(
    TRUE(),
    SelectedChannel = "B&M", MAX(DIM_Product[Index B&M]),
    SelectedChannel = "eshop", MAX(DIM_Product[Index eshop]),
    MAX(DIM_Product[Index B&M]) -- Default or when no selection is made
)

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

 

LinkedIn|Twitter|Blog |YouTube 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.