Reply
shareezsaleem
Helper III
Helper III
Partially syndicated - Outbound

Show Only Top N In Column Level

Hi All,

I have a matrix like below:

Level 1    WBS1 WBS2 WB3.....WBS723

MACHS   12       34       44

PAX         28       44       22

ELEC.       60       32      11

Total       100     110     77

 

How can I show Top 50 WBS where as by total WBS is 723 (Columns).

 

Regards

 

1 ACCEPTED SOLUTION
kushanNa
Resolver II
Resolver II

Syndicated - Outbound

Hi @shareezsaleem 

 

did you try to use the Top N filter on the filter panel? 

 

kushanNa_0-1742871468174.png

 

 

View solution in original post

6 REPLIES 6
kushanNa
Resolver II
Resolver II

Syndicated - Outbound

Hi @shareezsaleem 

 

did you try to use the Top N filter on the filter panel? 

 

kushanNa_0-1742871468174.png

 

 

Syndicated - Outbound

Thank you.

How can I sort the columns based on the column grand total?

shareezsaleem
Helper III
Helper III

Syndicated - Outbound

See the real data

I want to reduce the column to top 5 based on the rank of WBS (which is the sum of values)

 

shareezsaleem_0-1742813242336.png

WBS Rank Matrix:

shareezsaleem_1-1742813297635.png

WBS Rank = IF(HASONEVALUE(Finance[WBS_Rev.]),RANKX(ALL(Finance[WBS_Rev.]),[Actual MTD],,DESC,Dense))

 

AmiraBedh
Super User
Super User

Syndicated - Outbound

You may not be able to achieve what you want in PBI, but here is something that is a workaround.

You need to unpivot your columns :

  • Go to Transform Data

  • Select your table 

  • Select all WBS1 to WBS723 columns

  • Right-click > Unpivot Columns

  • Rename:

    • AttributeWBS

    • Value remains as is

From :

AmiraBedh_1-1742812286404.png

 

To :

AmiraBedh_0-1742812264933.png

Then create 2 measures :

Total Value by WBS = 
CALCULATE(
    SUM('RawData'[Value]),
    ALLEXCEPT('RawData', 'RawData'[WBS])
)

WBS Rank = 
RANKX(
    ALL('RawData'[WBS]),
    [Total Value by WBS],
    ,
    DESC,
    Dense
)

Show Top WBS = 
IF([WBS Rank] <= 50, 1, 0)

The last measure you will use it as a filter on the visual.

AmiraBedh_2-1742812435820.png

 

 

 

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Syndicated - Outbound

Please reply ..

Akash_Varuna
Resident Rockstar
Resident Rockstar

Syndicated - Outbound

Hi @shareezsaleem You could use DAX to calculate total for each column and then rank them and apply filter in Matrix ..... Please try this out
Calculate Total for Each Column:

TotalValuePerColumn = SUM('Table'[Value])

Replace value with your numerical column
Rank Columns:

RankColumns = RANKX(ALL('Table'[WBS]), [TotalValuePerColumn], , DESC)

Filter Top 50 Columns:
Apply a filter in the matrix visualization to show only columns where RankColumns ≤ 50

avatar user

Helpful resources

Announcements
FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)