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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JoeMel
Frequent Visitor

Clustered column and two columns in x-axis : how to sort and TOP 15 ?

Dear community,
Using a column chart, I have two columns in x-axis and a measure in y-axis.

I would perform a TOP 15 by year, sorted by "Sum_measure".

Pleae could you help me ?

Thank you.

 

File : Power BI file 

1 ACCEPTED SOLUTION
JoeMel
Frequent Visitor
2 REPLIES 2
JoeMel
Frequent Visitor

DataNinja777
Super User
Super User

Hi @JoeMel ,

 

You can write topn measure like below to achieve your desired output:

Top15CustomerSales = 
VAR TopCustomers = 
    TOPN(
        15,
        SUMMARIZE(
            ALL('Sales'),
            'Sales'[Customer],
            "TotalSales", SUM('Sales'[Sales])
        ),
        [TotalSales],
        DESC
    )
RETURN
IF(
    CONTAINS(TopCustomers, 'Sales'[Customer], SELECTEDVALUE('Sales'[Customer])),
    SUM('Sales'[Sales]),
    BLANK()
)

The resultant output will look like below:

DataNinja777_0-1731065587963.png

DataNinja777_1-1731065881032.png

 

I have attached an example pbix file.

 

 

 

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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