Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to Sort a Columns in a table by only using Slicer?

Hi Everyone,    Requesting you post the solutin or any advice for the below question.   TABLE1 EMP ID SALARY SAVINGS EXPENSES TAX PAID 1 10000 1000 9000 500 2 5000 1500 3500 ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    You can try this measure

    SORT =
    SWITCH (
        SELECTEDVALUE ( 'Slicer 2'[Sort] ),
        "ASC",
            SWITCH (
                SELECTEDVALUE ( 'Slicer 1'[Metric] ),
                "EXPENSES", SUMX ( 'TABLE1', [EXPENSESASC] ),
                "SALARY", SUMX ( 'TABLE1', [SALARYASC] ),
                "SAVINGS", SUMX ( 'TABLE1', [SAVINGSASC] ),
                "TAX PAID", SUMX ( 'TABLE1', [TAX PAIDASC] )
            ),
        "DSC",
            SWITCH (
                SELECTEDVALUE ( 'Slicer 1'[Metric] ),
                "EXPENSES", SUMX ( 'TABLE1', [EXPENSESDESC] ),
                "SALARY", SUMX ( 'TABLE1', [SALARYDESC] ),
                "SAVINGS", SUMX ( 'TABLE1', [SAVINGSDESC] ),
                "TAX PAID", SUMX ( 'TABLE1', [TAX PAIDDESC] )
            )
    )

     

     

    You can check more details from here.

     

     

    Best Regards,

    Stephen Tao

     

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