cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
spartachek
Frequent Visitor

Ranking Measure

Everyone, I need your help again. I am struggling with creating a measure to rank manufacturers withing a category. I am attaching the sample data and desired result, as well as data model screenshot.

 

"OOW / Direct" is a calculated column in the table "DATA". "Manufacturer" is a column in another table. As you can see below the context is changed by two filters - "Month" and "CC ID".

 

Any ideas?

 

Data Model.PNGSample Data.PNG

1 ACCEPTED SOLUTION

Can you use ISFILTERED?

Ranking = 
VAR OOW_DIR = VALUES ( Data[OOW / DIR] )
RETURN 
IF ( NOT ISBLANK ( [Sales Amount] ),
    IF ( ISFILTERED ( MANUFACTURER[MFGRID] ),
        CALCULATE( 
            RANKX ( 
                ALLSELECTED ( MANUFACTURER ), 
                [Sales Amount] ), 
            OOW_DIR
        ) 
    )
)

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

Hello @spartachek 

I uploaded my sample .pbix file here for you to look at.  MFR_Ranking.pbix

Give this measure a try:

Ranking = 
VAR OOW_DIR = VALUES ( Data[OOW / DIR] )
RETURN 
IF ( NOT ISBLANK ( [Sales Amount] ),
    IF ( ISINSCOPE ( MANUFACTURER[MFGRID] ),
        CALCULATE( 
            RANKX ( 
                ALLSELECTED ( MANUFACTURER ), 
                [Sales Amount] ), 
            OOW_DIR
        ) 
    )
)

Thank you for such a quick reply.

Any chance to re-write the measure without using "ISINSCOPE" function?

I am limited to an older version of Power BI / DAX 😞

Long story

Can you use ISFILTERED?

Ranking = 
VAR OOW_DIR = VALUES ( Data[OOW / DIR] )
RETURN 
IF ( NOT ISBLANK ( [Sales Amount] ),
    IF ( ISFILTERED ( MANUFACTURER[MFGRID] ),
        CALCULATE( 
            RANKX ( 
                ALLSELECTED ( MANUFACTURER ), 
                [Sales Amount] ), 
            OOW_DIR
        ) 
    )
)

Yes, it works like a charm.

 

I checked the first solution at home too with an updated version of Power BI --> works!

 

Thank you again.

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors