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
_google
Helper I
Helper I

3#DAX : FIND ROW NUMBER BASED ON CRITERIA

 

Hi Experts

 

Reaching out again for the DAX formula to arrive at calcuated formula to find the row number based on Criteria. For example Attrribute is valid if the marked as "Yes" in the source data table.

 

Required in DAX a calcuated column which will find the row number in serial where there is criteria is matched.

 

I tried with calcuate( count(), filter())) but believe my filter context is not correct.

 

 

Normal Excel formula

'=IF($C2="Yes",ROW(A2),"")

 

TypeAttributeIs Valid normarl excel ( cell reference) can we have inDAXDAX Function
AA1Yes 2 1??
AA2Yes 3 2 
AA3     
AA4     
AA5Yes 6 3 
AA6Yes 7 4 
AA7Yes 8 5 
1 ACCEPTED SOLUTION

@_google

 

May be you can use this Column

 

Column =
VAR myrank =
    RANKX (
        FILTER ( TableName, TableName[Is Valid] = "Yes" ),
        TableName[Attribute],
        ,
        ASC,
        DENSE
    )
RETURN
    IF ( TableName[Is Valid] = "Yes", myrank )

 

 

thiscolumn.png 

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Not understanding what you are going for here but I can say that you probably need to add an Index column in Power Query to your query.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@_google

 

May be you can use this Column

 

Column =
VAR myrank =
    RANKX (
        FILTER ( TableName, TableName[Is Valid] = "Yes" ),
        TableName[Attribute],
        ,
        ASC,
        DENSE
    )
RETURN
    IF ( TableName[Is Valid] = "Yes", myrank )

 

 

thiscolumn.png 

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.