Forum Discussion

AkashGhinmine's avatar
AkashGhinmine
New Member
1 year ago
Solved

Power BI | Dynamic Sorting Based on User Selection

Hi Everyone!  I have a task in Power BI and needed your help on dynamic sorting.  I have the below table in my power bi report -      And I have created the below matrix visual to show...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi AkashGhinmine 

     

    You can try to create two tables to store [Tender Name] and the rankings based on two different date columns, and use field parameters to switch the sorting.

    1. Create two tables using the following DAX:

    ITT_TenderRanks = 
    ADDCOLUMNS(
        DISTINCT('Table'[Tender Name]),
        "ITT Rank", RANKX(ALL('Table'), CALCULATE(MAX('Table'[ITE Forecast Date])), , ASC, Dense)
    )
    PQQ_TenderRanks = 
    ADDCOLUMNS(
        DISTINCT('Table'[Tender Name]),
        "PQQ Rank", RANKX(ALL('Table'), CALCULATE(MAX('Table'[PQQ Forecast Date])), , ASC, Dense)
    )

    2. Set the [Tender Name] column in both tables to be sorted by the ranked column:

    3. Create a one-to-many unidirectional relationship between these two tables and the Forecast table:

    4. Select the [Tender Name] field in both tables to create the field parameter:

    5. Create a slicer with the field parameter and replace the [Tender Name] field with the field parameter in the matrix visual.

     

    Best Regards,
    Jarvis Tang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.