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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
mzutshi
Regular Visitor

Power BI Static rows in Matrix Visual

I have created below matrix using a table having tickets data with fields as Resolution Breached Final and Priority . Resolution Breached Final contains two values as "SLA Met" and " Breached" and Priority has"P1","P2","P3" AND "P4".  Percentage below the priorities is a matrix which calculates % of total tickets meeting SLA/ Total number of tickets

 

 

mzutshi_1-1714668804779.png

 

I Need to have static rows above Breached row in the above matrix ,which contains below data. ESL and MSl data will not change.

mzutshi_2-1714669069322.png

 

How do i achieve this ?

 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @mzutshi ,

We can create a new table for the rows of the matrix like this.

vcgaomsft_0-1714715126841.png

You can refer to M-code like this:

let
    Source = Table.FromList(List.Distinct(Table[Resolution Breached Final]) & {"ESL","MSL"}, null, {"Resolution Breached Final"}),
    #"Added Conditional Column" = Table.AddColumn(Source, "Sort", each if [Resolution Breached Final] = "ESL" then 0 else if [Resolution Breached Final] = "MSL" then 1 else if [Resolution Breached Final] = "Breached" then 2 else if [Resolution Breached Final] = "SLA Met" then 3 else null)
in
    #"Added Conditional Column"

And the relationships:

vcgaomsft_1-1714715290256.png

Then please create a new measure.

NewMeasure = 
VAR __cur_row = SELECTEDVALUE('Table2'[Resolution Breached Final])
VAR __cur_col = SELECTEDVALUE('Table'[Priority])
VAR __result = 
SWITCH(
    TRUE(),
    // [Measure] is the value field of the original matrix
    __cur_row IN {"Breached","SLA Met"},CALCULATE( [Measure], 'Table'[Resolution Breached Final]=__cur_row ),
    __cur_row = "ESL", SWITCH( __cur_col, "P1", 1, "P2", 0.92, "P3", 0.96, "P4", 0.99),
    __cur_row = "MSL", SWITCH( __cur_col, "P1", 0.9, "P2", 0.9, "P3", 0.92, "P4", 0.95)
)
RETURN
__result

Output:

vcgaomsft_2-1714715410984.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

2 REPLIES 2
mzutshi
Regular Visitor

Thank you so much @v-cgao-msft 

v-cgao-msft
Community Support
Community Support

Hi @mzutshi ,

We can create a new table for the rows of the matrix like this.

vcgaomsft_0-1714715126841.png

You can refer to M-code like this:

let
    Source = Table.FromList(List.Distinct(Table[Resolution Breached Final]) & {"ESL","MSL"}, null, {"Resolution Breached Final"}),
    #"Added Conditional Column" = Table.AddColumn(Source, "Sort", each if [Resolution Breached Final] = "ESL" then 0 else if [Resolution Breached Final] = "MSL" then 1 else if [Resolution Breached Final] = "Breached" then 2 else if [Resolution Breached Final] = "SLA Met" then 3 else null)
in
    #"Added Conditional Column"

And the relationships:

vcgaomsft_1-1714715290256.png

Then please create a new measure.

NewMeasure = 
VAR __cur_row = SELECTEDVALUE('Table2'[Resolution Breached Final])
VAR __cur_col = SELECTEDVALUE('Table'[Priority])
VAR __result = 
SWITCH(
    TRUE(),
    // [Measure] is the value field of the original matrix
    __cur_row IN {"Breached","SLA Met"},CALCULATE( [Measure], 'Table'[Resolution Breached Final]=__cur_row ),
    __cur_row = "ESL", SWITCH( __cur_col, "P1", 1, "P2", 0.92, "P3", 0.96, "P4", 0.99),
    __cur_row = "MSL", SWITCH( __cur_col, "P1", 0.9, "P2", 0.9, "P3", 0.92, "P4", 0.95)
)
RETURN
__result

Output:

vcgaomsft_2-1714715410984.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.