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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Yonah
Helper II
Helper II

Ranking Products by Year ignoring Filters

Hi,
I'm  working on a Matrix, with multiply values.
And I want to have a Ranking for Value 1, based on it share per Year.

My Problem is, the ranking must ignore all filters.
Attached is the link to the Power-Bi file and the files used.
The example is very simplified. And the final matrix will contain many more values.
But only one Value to Rank.
In my Example Matrix, they are all filters include, that I'm going to use.
https://1drv.ms/u/s!AoFqgLqZH-C0hMlyC4Tfi42fjo_-pg?e=fvB0pq

My Matrix locks like this:

Year202020202021202120222022
 Value 1End of day balance <10Value 1End of day balance <10Value 1End of day balance <10
Articel A77848,12061057,88026475,550
Articel B175213,490127773,10053784,530

 

The Matrix I want should look like thsi:

Year2020202020202021202120212022 2022
 Value 1Ranking for Value 1End of day balance <10Value 1Ranking for Value 1End of day balance <10Value 1Ranking for Value 1End of day balance <10
Articel A77848,122061057,882026475,5520
Articel B175213,4910127773,101053784,5310


Many Thanks in Advance

1 ACCEPTED SOLUTION

@Yonah 

I will have a look at the file tomorrow morning. Meanwhile, you may try

=
RANKX (
    CALCULATETABLE ( '01', ALLEXCEPT ( '01', 'Date'[Year] ) ),
    CALCULATE ( SUM ( '01'[Number 1] ) )
)

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @Yonah 
Not sure if this is what you want. Here is the sample file with the proposed solution https://we.tl/t-fGjyeH6eGx

1.png

Test = 
IF (
    NOT ISBLANK ( SUM ( '01'[Number 1] ) )
        && HASONEVALUE ( '02'[Name] ),
    RANKX (
        ALLSELECTED ( '02'[Name] ),
        CALCULATE ( SUM ( '01'[Number 1] ) )
    )
)
Yonah
Helper II
Helper II

Thanks @tamerj1 .
But I try it, and its not working.
That was my DAX.

RANKX ( CALCULATETABLE ('01', ALLEXCEPT ( '01','01'[Jahr] ), '01'[Number 1] ))
And the Error I get is "Too few arguments are passed to the rankx function"

And I'm not sure if it's going to work, since my Fact-Table only contains a Date-Colume and is conectet to a Date-Tabel with Year, Month and so on.

@Yonah 

Just the location of brackets. You may use the same as measure

 

=
RANKX (
    CALCULATETABLE ( '01', ALLEXCEPT ( '01', 'Date'[Year] ) ),
    SUM ( '01'[Number 1] )
)

 

It's working.
But now evrey Articel has the same Rank.
Rank 1.

You can finde the Power BI File here.
https://1drv.ms/u/s!AoFqgLqZH-C0hMlyC4Tfi42fjo_-pg?e=X7jkNv

@Yonah 

I will have a look at the file tomorrow morning. Meanwhile, you may try

=
RANKX (
    CALCULATETABLE ( '01', ALLEXCEPT ( '01', 'Date'[Year] ) ),
    CALCULATE ( SUM ( '01'[Number 1] ) )
)
tamerj1
Super User
Super User

Hi @Yonah 

if you want to ignore all filters then create a calculated column.
RANKX ( CALCULATETABLE (Products, ALLEXCEPT ( Products,Products[Year] ), [Amount] )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.