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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
ReikoK
Helper I
Helper I

RANKX formula help

Hi eveyone!

 

Problem is , that I cannot figure out how keep and rank only these brands, which only has value in GRP column. At the moment it considers all the brands (I know, that I have ALL function in my code).

 

Code: 

GRP rank =
VAR lastyear = MAX(Calender[Year])

VAR _rank =
    RANKX(ALL('FINAL data'[Main brands]); [Last year GRP];;DESC;Dense
    )
VAR _other =
    CALCULATE(IF ( MAX ( 'FINAL data'[Main brands] ) = "OTHERS"; 0;_rank); Calender[Year] = lastyear)
RETURN
    _other

 

How the table looks with GRP rank measure at the moment

ReikoK_0-1713114888189.png

 

Sample data and PBIX: https://we.tl/t-6fUewOOSRb

4 REPLIES 4
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Sample data and PBix is here:

https://we.tl/t-6fUewOOSRb

You need to filter by GRP, something like this:

 

VAR _rank =
    RANKX(FILTER(ALLSELECTED('FINAL data'[Main brands]),[Total GRP]>0),[Viimase aasta GRP],
        ,
        ASC,
        DENSE
    )

 

You seem to have a few too many measures, and a lot of measure tables.  Please don't uses ADDCOLUMNS(),  , use something like

 

TV mõõdikud = {1}

Did not solved my problem, but managed to find the solution myself. Thank you for helping!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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