cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to display Top 5 and Bottom 5 in the single chart?

Hi,

 

Anyone know how to do that?

 

Thanks!

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

You can use below calculate column who ranking by two columns and mark flag based on ranking amount.

Category =
VAR _rank =
    COUNTROWS (
        FILTER (
            Sheet1,
            ISONORAFTER (
                    Sheet1[Revenue], EARLIER ( Sheet1[Revenue] ), ASC,
                    Sheet1[Sales Volume], EARLIER ( Sheet1[Sales Volume] ), ASC
            )
        )
    )
RETURN
    IF (
        _rank <= 5,
        "Top 5",
        IF ( _rank >= MAXX ( Sheet1, [SN] ) - 5, "Bottom 5", "Normal" )
    )

23.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
Helper II
Helper II

Hi Shiwen,

 

Can you please elaborate what do you mean by Top 5 and Bottom 5??

 

In general, this can be handled using a DAX query or M language which unions Top 5 and Bottom 5 attributes/measures.

 

Regards,

Hari T

Anonymous
Not applicable

Hi Hari,

 

I need to show the top-5 product by sales revenue and bottom-5 product by sales volume using a scatter chart with x-axis showing sales volume and y-axis showing revenue. I tried using the top-n filter but only 1 filter can be used. How will I be able to achieve this with DAX query or M language?

 

Thanks

HI @Anonymous,

 

Please provide a pbix file with sample data and expected result to help clarify your requirement and test to coding formula.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hi Xiaoxin Sheng,

 

Please download this link for the sample data as well as the expected output.

https://www.dropbox.com/s/9zl9eaozer0pyq0/Sample%20data.xlsx?dl=0

 

The chart should display the products color only green and red.

 

Need some help from you guys on how to show the data correctly.

Hi @Anonymous,

 

You can use below calculate column who ranking by two columns and mark flag based on ranking amount.

Category =
VAR _rank =
    COUNTROWS (
        FILTER (
            Sheet1,
            ISONORAFTER (
                    Sheet1[Revenue], EARLIER ( Sheet1[Revenue] ), ASC,
                    Sheet1[Sales Volume], EARLIER ( Sheet1[Sales Volume] ), ASC
            )
        )
    )
RETURN
    IF (
        _rank <= 5,
        "Top 5",
        IF ( _rank >= MAXX ( Sheet1, [SN] ) - 5, "Bottom 5", "Normal" )
    )

23.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

Sheing - I would be interested to know what represents 'SN' in the table?

Can you please share the sample data used in this example. I'm not able to undestand the column [SN]

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors