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
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
Employee
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
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.