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
AlexGlz
Frequent Visitor

Replace Earlier in measure

Hi all!

 

I'm trying to get a rank measure in order to get a TOP 5 in every hierarchy level in a visual.

 

For now I have four different columns with the corresponding Rank in every case of the Hierarchy level (Year-Quarter-Month-Day). I was just testing that the formula works, but cause I need to select the corresponding column based on a hierarchy, I can't make a simple "IF" column because it wouldn't react to the hierarchy drill.

 

So I tryed to make a measure with the same formula but I got stucked when the measure told me that I couldn't use the function EARLIER beacuse of the table context, so i need to repleace the formula with another fuction or something that let me do the same but without the EARLIER.

 

this is my first formula and if I solve this one i could solve the other ones without problem:

 

Year lvl Rank = RANKX(
FILTER(
          'LGE Block' ,
          'LGE Block'[MCBF]<>0 &&
          'LGE Block'[From Date].[Year] = EARLIER('LGE Block'[From Date].[Year])
),
'LGE Block'[MCBF],,ASC,Dense
)
 
Please if you have any ideas of how to take this formula into a measure would be very helpful to me
3 REPLIES 3
v-xuding-msft
Community Support
Community Support

Hi @AlexGlz ,

Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from here. If you are still confused about it, please share some sample data.

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-xuding-msft
Community Support
Community Support

Hi @AlexGlz ,

Maybe you could try the formula firstly. If it is not what you want, please share some sample data and  expected results. Then we will understand clearly.

 

Year lvl Rank =
RANKX (
    FILTER (
        ALL ( 'LGE Block' ),
        'LGE Block'[MCBF] <> 0
            && 'LGE Block'[From Date].[Year]
                = MAX ( 'LGE Block'[From Date].[Year] ) - 1
    ),
    'LGE Block'[MCBF],
    ,
    ASC,
    DENSE
)

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.