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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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