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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
tomaszes19
Frequent Visitor

Matrix to display specific measure for each row if condition met

Hi All,

I would like to create a matrix where one measure will be displayed only for one row [name], so I have 4 different measures in 4 rows:
Matrix

 Dates....
Row for Name A Values for Measure 1
Row for Name BValues for Measure 2
Row for Name CValues for Measure 3
Row for Name DValues for Measure 4


I am able to do it with SWITCH() and SELECTEDVALUE() functions, but it does not work exactly as I want it to.
When I put TRUE() as first argument in SWITCH() function, it only shows 2 rows and when I change it to FALSE() it shows to other rows.
Here is a formula I use:

 

Selected ES code =
SWITCH(
TRUE(),
SELECTEDVALUE('Table1'[NamesColumn]) == "Name A", [Measure 1],
SELECTEDVALUE('Table1'[NamesColumn]) == "Name B", [Measure 2],
SELECTEDVALUE('Table1'[NamesColumn]) == "Name C", [Measure 3],
SELECTEDVALUE('Table1'[NamesColumn) == "Name D", [Measure 2],
BLANK()
)

 

Can anybody help?

2 REPLIES 2
amitchandak
Super User
Super User

@tomaszes19 , Assuming  Namescolumn is used in visual

 

try like

 

Selected ES code =

Sumx(Values('Table1'[NamesColumn), calculate(
SWITCH(
TRUE(),
max('Table1'[NamesColumn]) = "Name A", [Measure 1],
max('Table1'[NamesColumn]) = "Name B", [Measure 2],
max('Table1'[NamesColumn]) = "Name C", [Measure 3],
max('Table1'[NamesColumn) = "Name D", [Measure 2],
BLANK()
) ))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

It turned out I made a mistake in the called measures... Sorry and thank you for your time!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.