cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mhnsan1113
Frequent Visitor

Topn N sorting for Stacked bar chart

Hi All

Need help and support one issue

In Tableau there is feature of showing Top N for stacked bar chart as shown below by Business Unit & By Company Code

each have individual sliders. If I change 6 or 7 for Business Unit (BU) it shows 6 & 7 respectively

Mhnsan1113_0-1628082424146.png

If am applying same in powerbi , i am not getting the results. i used by creating table 

1) Rank by BU = GENERATESERIES(0, 20, 1)
2 ) Rank by BU Value = SELECTEDVALUE('Rank by BU'[Rank by BU])

then went to main table and created

(a)selectRanktopnumber. = IF(HASONEVALUE('Rank by BU'[Rank by BU]),MIN('Rank by BU'[Rank by BU]),20)

(b)Rankby BU. = IF(HASONEVALUE(po_change[business_unit]),RANKX(ALL(po_change[business_unit]),[PO Line No Count],,DESC))
(c)BU-RANK Final. = if ([(b)Rankby BU.]<[(a)selectRanktopnumber.],1,0)
Used the (c) in filters & 1) as slicer (marked in yellow). 
Mhnsan1113_3-1628085272521.png   Mhnsan1113_2-1628084985761.png

Its not getting sorted instead of 2 i'm getting 4 business unit.

Request if someone can help on the workaround

 

 Thanks in Advance

 

3 REPLIES 3
Mhnsan1113
Frequent Visitor

Hi

i am not able to attached the test pbix file. when clicked on insert is asking for url.

how do i copy/paste the file.

 

Please guide

 

Hi @Mhnsan1113,

You can upload it to your network driver and share the link here. 

Notice: please not attach sensitive data in your sample.

Regards,

Xiaoxin Sheng

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

Hi @Mhnsan1113,

Can you please share a pbix file or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

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

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!