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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DarshanKumar
Helper I
Helper I

Need help with formatting of Matrix visual

Hi,

 

I need your help in showing the data as per the below table. I was able to achive the same using  matrix visual  with option "Switch value to rows". I need help in creating Target column and also to have the table header.

 

Any help is highly apprecia

 

Metric Vs. PM Target
Headcount (Var. Prior Month) 1  
     
Attrition (LTM) 20% <17%
Attrition (length of service) -10 <10%
Attrition (Regretted vs Non Regretted)    
     
Time to Offer (LTM) 36 43 days
     
Agency vs Internal (LTM) 10% <9%
     
Open Roles (Var. Prior Month) -10  
1 ACCEPTED SOLUTION

Hi @DarshanKumar ,

If your actual values (like “Vs Prior Month”) are coming from a measure, then NO, you do not need to create three physical columns in your table.

Here’s what you can do instead:
🧱 1. Create a Supporting Table for Metrics

You’ll still need a single-column table listing your metric names to act as rows in the Matrix:

Go to Modeling → New Table and create:

MetricList = 
DATATABLE(
    "Metric", STRING,
    {
        {"Headcount (Var. Prior Month)"},
        {"Attrition (LTM)"},
        {"Attrition (length of service)"},
        {"Attrition (Regretted vs Non Regretted)"},
        {"Time to Offer (LTM)"},
        {"Agency vs Internal (LTM)"},
        {"Open Roles (Var. Prior Month)"}
    }
)


🧮 2. Create a Measure for Each Column

Measure 1: Vs Prior Month

Vs_PM_Measure = 
SWITCH(
    SELECTEDVALUE(MetricList[Metric]),
    "Headcount (Var. Prior Month)", [HeadcountVsPrior],
    "Attrition (LTM)", [AttritionLTM],
    "Attrition (length of service)", [AttritionLength],
    "Attrition (Regretted vs Non Regretted)", [AttritionRegret],
    "Time to Offer (LTM)", [TimeToOffer],
    "Agency vs Internal (LTM)", [AgencyVsInternal],
    "Open Roles (Var. Prior Month)", [OpenRolesVsPrior],
    BLANK()
)

(Each [MeasureName] here is your actual measure that already exists.)


Measure 2: Target

Target_Measure = 
SWITCH(
    SELECTEDVALUE(MetricList[Metric]),
    "Attrition (LTM)", "<17%",
    "Attrition (length of service)", "<10%",
    "Time to Offer (LTM)", "43 days",
    "Agency vs Internal (LTM)", "<9%",
    BLANK()
)


🎨 3. Build the Matrix Visual

  • Put MetricList[Metric] in Rows

  • Add Vs_PM_Measure and Target_Measure to Values

  • In Values pane, turn on “Show on rows” (so columns stack vertically)


💡 Result

You get:

Metric Vs. PM Target

Headcount (Var. Prior Month)1 
Attrition (LTM)20%<17%
.........

And this is fully dynamic and driven by your existing measures.



Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀 [Explore More]

View solution in original post

7 REPLIES 7
DarshanKumar
Helper I
Helper I

Thank you @GrowthNatives  works exactly the way I needeed.

 

Many thanks for your help.

Hi @DarshanKumar ,
🌟So glad to hear it worked exactly as you needed!

If this solution helped, feel free to click 'Mark as Solution' to guide others too.
Appreciate the kudos👍—it keeps the Power BI community strong and thriving!
🚀Here’s to more powerful, data-driven insights together!🚀

samratpbi
Super User
Super User

Hi, are you taking about formatting of the column? if that is the case, then you can use the dynamic formatting of the column to show either in number, percentages 

I need help in adding additional columnto the matrix.

 

My actual values(Column name Vs prior month) are coming from the measure, so I need helpw to add the target column to the visual.

 

Regards,

Darshan 

GrowthNatives
Resolver II
Resolver II

Hi @DarshanKumar ,
To replicate the table structure and formatting from your screenshot in Power BI Matrix visual I would go about it like this.

🧱 1. Design Your Base Table

You need a table (either manually created or from a data source) with 3 key columns:

Metric Vs. PM Target

Headcount (Var. Prior Month)1 
Attrition (LTM)20%<17%
Attrition (length of service)-10<10%
Attrition (Regretted vs Non Regretted)  
Time to Offer (LTM)3643 days
Agency vs Internal (LTM)10%<9%
Open Roles (Var. Prior Month)-10 

You can manually create this using "Enter Data" in Power BI.

📊 2. Build the Matrix Visual

Once the table is ready:

  1. Go to Visualizations pane → Select the Matrix visual.

  2. Drag:

    • Metric to Rows.

    • Vs. PM and Target to Values.

  3. In Values, click on the dropdown → "Show on rows" (to switch values into rows).


🎯 3. Fix Header (Table Title)

Power BI Matrix doesn't allow a native table title row above column headers. But here's a workaround:

Workaround using Card or Text box:

  • Add a Text Box above your Matrix visual.

  • Enter "Metric", "Vs. PM", "Target" as your header row manually (formatted to match Matrix column width).

  • Align it precisely above the Matrix.


🧠 Optional (Advanced): Dynamic Target as Measure

If you want to define Target values via logic (not static), you can use a measure like:

Target_Measure = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Metrics[Metric]) = "Attrition (LTM)", "<17%",
    SELECTEDVALUE(Metrics[Metric]) = "Attrition (length of service)", "<10%",
    SELECTEDVALUE(Metrics[Metric]) = "Time to Offer (LTM)", "43 days",
    SELECTEDVALUE(Metrics[Metric]) = "Agency vs Internal (LTM)", "<9%",
    BLANK()
)

Then use Target_Measure in Values instead of static column.

Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀[Explore More]

Hi GrowthNatives,

 

My actual values(Column name Vs prior month) are coming from the measure, do I still need three coulmns in the table

Hi @DarshanKumar ,

If your actual values (like “Vs Prior Month”) are coming from a measure, then NO, you do not need to create three physical columns in your table.

Here’s what you can do instead:
🧱 1. Create a Supporting Table for Metrics

You’ll still need a single-column table listing your metric names to act as rows in the Matrix:

Go to Modeling → New Table and create:

MetricList = 
DATATABLE(
    "Metric", STRING,
    {
        {"Headcount (Var. Prior Month)"},
        {"Attrition (LTM)"},
        {"Attrition (length of service)"},
        {"Attrition (Regretted vs Non Regretted)"},
        {"Time to Offer (LTM)"},
        {"Agency vs Internal (LTM)"},
        {"Open Roles (Var. Prior Month)"}
    }
)


🧮 2. Create a Measure for Each Column

Measure 1: Vs Prior Month

Vs_PM_Measure = 
SWITCH(
    SELECTEDVALUE(MetricList[Metric]),
    "Headcount (Var. Prior Month)", [HeadcountVsPrior],
    "Attrition (LTM)", [AttritionLTM],
    "Attrition (length of service)", [AttritionLength],
    "Attrition (Regretted vs Non Regretted)", [AttritionRegret],
    "Time to Offer (LTM)", [TimeToOffer],
    "Agency vs Internal (LTM)", [AgencyVsInternal],
    "Open Roles (Var. Prior Month)", [OpenRolesVsPrior],
    BLANK()
)

(Each [MeasureName] here is your actual measure that already exists.)


Measure 2: Target

Target_Measure = 
SWITCH(
    SELECTEDVALUE(MetricList[Metric]),
    "Attrition (LTM)", "<17%",
    "Attrition (length of service)", "<10%",
    "Time to Offer (LTM)", "43 days",
    "Agency vs Internal (LTM)", "<9%",
    BLANK()
)


🎨 3. Build the Matrix Visual

  • Put MetricList[Metric] in Rows

  • Add Vs_PM_Measure and Target_Measure to Values

  • In Values pane, turn on “Show on rows” (so columns stack vertically)


💡 Result

You get:

Metric Vs. PM Target

Headcount (Var. Prior Month)1 
Attrition (LTM)20%<17%
.........

And this is fully dynamic and driven by your existing measures.



Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀 [Explore More]

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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