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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Top and others with use of filter and represent it in graph

Hi Guys,

 

This is a little complicated problem, I have a table which has data conatisn few columns named URL Domain, Region and Impact. 

URL DomainRegionImpact
udf.dkDNK0.0345
vpo.dkDNK0.1234
123in.dkDNK0.0658
bee.dkDNK0.05478
efsh.esESP0.234
ahle.esESP0.00654
1n1.esESP0.0876
bonus.esESP0.0238
acd.frFRA0.1834
abnb.frFRA0.0564
bonj.frFRA0.8723
abc.comGBR0.004522
def.comGBR0.1235
123.ukGBR0.0398
360.ukGBR0.04587

 

 

No I want to represent Top 2 URL domain based on Impact and region will be a filter. 

So when I click GBR then Top 2 for GBR shoudl show up and rest of the GBR domain should add upto Others

def.comGBR0.1235
360.ukGBR0.04587
OthersGBR0.044322

 

And I want this to repsent the above table in a graph. 

Help is very much appreciated. This is really important problem.

 

Cheers

Shruti

 

Thank you so much in advance

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Please follow the steps below.

 

1. Create an index column in Query Editor.

 

2. Create the calculated column below.

Category =
VAR r =
    RANKX (
        FILTER ( 'Table1', 'Table1'[Region] = EARLIER ( Table1[Region] ) ),
        'Table1'[Impact],
        ,
        DESC
    )
RETURN
    IF ( r <= 2, 'Table1'[URL Domain], "others" )

3. Create the measure with the formula below.

Measure =
IF (
    MAX ( 'Table1'[Category] ) = "others",
    CALCULATE (
        SUM ( 'Table1'[Impact] ),
        FILTER ( 'Table1', 'Table1'[Category] = "others" )
    ),
    MAX ( 'Table1'[Impact] )
)

4. Then you will get your desired output.

 

output.PNG

 

More details, you could refer to the attachment. You also could refer to the blog.

 

Best  Regards,

Cherry

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

View solution in original post

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Please follow the steps below.

 

1. Create an index column in Query Editor.

 

2. Create the calculated column below.

Category =
VAR r =
    RANKX (
        FILTER ( 'Table1', 'Table1'[Region] = EARLIER ( Table1[Region] ) ),
        'Table1'[Impact],
        ,
        DESC
    )
RETURN
    IF ( r <= 2, 'Table1'[URL Domain], "others" )

3. Create the measure with the formula below.

Measure =
IF (
    MAX ( 'Table1'[Category] ) = "others",
    CALCULATE (
        SUM ( 'Table1'[Impact] ),
        FILTER ( 'Table1', 'Table1'[Category] = "others" )
    ),
    MAX ( 'Table1'[Impact] )
)

4. Then you will get your desired output.

 

output.PNG

 

More details, you could refer to the attachment. You also could refer to the blog.

 

Best  Regards,

Cherry

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.