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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MichaelZang
Helper I
Helper I

Dynamically Align Company Order Between Cluster Chart and Matrix Based on Quarter Slicer

Hi everyone,

 

I hope you can help me with this issue - thanks in advance! 😊

 

Context: You can see from the attached image below that I have:

Cluster Chart

  • x-axis: company_name
  • y-axis: USG
  • legend: period_label

Matrix

  • Row: Metric
  • Column: company_name
  • Value: Metric Value

MichaelZang_1-1741252791110.png

Problem: I need to ensure that the Cluster Chart is sorted in descending order of USG AND that the Matrix dynamically follows this same order for company names based on the selected period and year in the slicer.

For example:

  • Q4 2022: Cluster Chart company order is A, B, C, D -> Matrix company order should be A, B, C, D
  • Q1 2023: Cluster Chart company order is B, D, A, C -> Matrix company order should be B, D, A, C

Attempts so far (unsuccessful):

  • Tried both horizontal and vertical charts but couldn't achieve the desired sorting
  • Attempted to create a hierarchy sorting by USG (UPG and UVG are under USG), but it did not work

Looking for a solution to make the Matrix column/row dynamically follow the Cluster Chart's USG-based order. 😓

 

Note: I created the company_order_index to align the Cluster Chart and Matrix, but it's only a temporary fix since the company order remains static, which is not the intended outcome.

 

What I need:

MichaelZang_0-1741254288683.png

 

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @MichaelZang 

 

Matrix values are sorted based on the total column so the total must return the value for USG

UPG_UVG_UOM_Values = 
VAR _USG =
    CALCULATE (
        SUM ( fact_financials_unpivoted_percentage[Metric Value] ),
        fact_financials_unpivoted_percentage[Metric] = "USG"
    )
RETURN
    IF (
        NOT ( HASONEVALUE ( fact_financials_unpivoted_percentage[Metric] ) ),
        _USG,
        CALCULATE (
            SELECTEDVALUE ( fact_financials_unpivoted_percentage[Metric Value] ),
            FILTER ( ALL ( dim_region ), dim_region[region_name] = "Total Company-Wise" )
        )
    )

danextian_1-1741256994047.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @MichaelZang 

 

Matrix values are sorted based on the total column so the total must return the value for USG

UPG_UVG_UOM_Values = 
VAR _USG =
    CALCULATE (
        SUM ( fact_financials_unpivoted_percentage[Metric Value] ),
        fact_financials_unpivoted_percentage[Metric] = "USG"
    )
RETURN
    IF (
        NOT ( HASONEVALUE ( fact_financials_unpivoted_percentage[Metric] ) ),
        _USG,
        CALCULATE (
            SELECTEDVALUE ( fact_financials_unpivoted_percentage[Metric Value] ),
            FILTER ( ALL ( dim_region ), dim_region[region_name] = "Total Company-Wise" )
        )
    )

danextian_1-1741256994047.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian 

Thank you for your quick response. I really appreciate your help on this issue

MichaelZang
Helper I
Helper I

DATA + PBIX FILE: HERE

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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