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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Tejesh_Gour
Helper I
Helper I

Avoid duplicate rank

I need help?

I have written DAX for TOP 5 Case and remaining should be in 'Other' category based on MAX COUNT casetype that is working but problem is in duplicate rank. I have written in TOM Model and RLS has applied:

M2:=

VAR Curr_Case =

    MAX ( FactCase[CaseType] )

VAR Temp_Tab =

    ALL ( FactCase )

VAR Temp_Tab1 =

    SUMMARIZE (

        Temp_Tab,

        FactCase[CaseType],

        "_ACount", COUNTA ( FactCase[CaseType] )

    )

VAR Temp_Tab2 =

    ADDCOLUMNS ( Temp_Tab1, "ARANK", RANKX ( Temp_Tab1, [_ACount] ) )

RETURN

    MAXX ( FILTER ( Temp_Tab2, [CaseType] = Curr_Case ), [ARANK] )

DuplicateCategory.PNG

 

 

 

6 REPLIES 6
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Tejesh_Gour ,

 

I tested your provided DAX formula with my sample data, it returned expected RANK value which skips duplicates. You just need an extra measure to class the casetype.

Category = IF([Rank measure]<=5,SELECTEDVALUE(FactCase[CaseType]),"Other")

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ExpectedOutput I cannot keep in legend(chart) which you have given that is calculated column. In chart I want to use this column in legent section and measure will be count. If you are not clear then I will send sample data file as well.

 

Single Value.PNG

Only single value is showing. I have written in TOM Model.
Not working!

Hi @Tejesh_Gour ,

 

From this screenshot, were [CaseType] and [M2] both measures? If so, it indeed returns only one single row because there is no row context in such a visual. You have to place some other fields like [CaseType] into visual.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft 

I need only CaseType and Count in visualization(Column chart) based on date but here measure i can't show in legend.

Hi @Tejesh_Gour ,

 

I am confused about your scenario, would you please share the sample .pbix file for check?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors