Forum Discussion

Yonah's avatar
Yonah
Helper II
4 years ago

Matrix sort by button (row and value)

Hi,
unfortunately I have not found the answer in the forum.
I have a Matrix with own row (year), one colume (name) and 7 Values.
See Picter below.
What I'm wondering now, is there a way to sort the matrix by year 2019 and number 1 or year 2020 and number 1 or year 2022 and number 5.

Meine Power-BI und die Daten sind bei diesen Link:
https://1drv.ms/u/s!AoFqgLqZH-C0hMo26abM9vKVp9jx8w?e=AklieI

Thank you very much

 

4 Replies

  • amitchandak 
    I know. I was just wondering, if ther is a soulotion to sort not by Grand totals but by Totaly by Row. In my Case, Year.

  • amitchandak 

    Updated:
    I had the idea to rank the values per year.
    Using this DAX:
    Number1_2019 =
    RANKX (
    Table2,
    IF (
    IF ( AVERAGE ( Table2[Year] ) = 2019, 1, 0 ) > 0,
    SUM ( Table2[Number 1] ),
    0
    )
    )

    But I get back only 1 for each entry, where is my error.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Yonah ,

    Please refer to y pbix file to see if it helps you.

    Create three columns.

    Column_2019 = RANKX(FILTER(Tabelle2,Tabelle2[Year]=2019),Tabelle2[Number 1],,DESC,Dense)
    Column_2020 = RANKX(FILTER(Tabelle2,Tabelle2[Year]=2020),Tabelle2[Number 1],,DESC,Dense)
    Column_2021 = RANKX(FILTER(Tabelle2,Tabelle2[Year]=2021),Tabelle2[Number 5],,DESC,Dense)

    If I have misunderstood your meaning, please provide more details

     

    Best Regards
    Community Support Team _ Polly

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