Forum Discussion

Madhu7624's avatar
Madhu7624
Regular Visitor
1 year ago
Solved

Sorting Data in Different Order Based on Slicer Selection in Power bi

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...
  • speedramps's avatar
    speedramps
    1 year ago

    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