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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Splitting Matrix Columns Based on Selection

Hello, I would like my matrix columns to be split based on if Employee is selected ("Yes") or not selected ("No").

 

I have my Base Table

ProductEmployeeUnits
AppleA1
PearA2
AppleB3
PearB4
AppleC5
PearC6
 
 

and Selection Table

Employee
A
B
C

 

Here is an example of the desired outcome if I select "A" from the selection table

ProductIn SelectionOut of Selection
Apple18
Pear210

 

I am new to Power BI and DAX, my experience in mostly in Tableau. If there is a solution that doesn't require the Selection Table, that is good too.

 

Thanks!

1 ACCEPTED SOLUTION
littlemojopuppy
Community Champion
Community Champion

Hi!  You're going to want to create two different measures that use the SELECTEDVALUE function, one for the total for employee selected and the other for all employees except the selected one.

 

Probably not syntactically perfect, but this should be close...

VAR
	SelectedEmployee = SELECTEDVALUE(Employee[Employee])
RETURN

CALCULATE(
	SUM(BaseTable[Units])
	Employee[Employee] = SelectedEmployee
)



VAR
	SelectedEmployee = SELECTEDVALUE(Employee[Employee])
RETURN

CALCULATE(
	SUM(BaseTable[Units])
	Employee[Employee] <> SelectedEmployee
)




View solution in original post

2 REPLIES 2
littlemojopuppy
Community Champion
Community Champion

Hi!  You're going to want to create two different measures that use the SELECTEDVALUE function, one for the total for employee selected and the other for all employees except the selected one.

 

Probably not syntactically perfect, but this should be close...

VAR
	SelectedEmployee = SELECTEDVALUE(Employee[Employee])
RETURN

CALCULATE(
	SUM(BaseTable[Units])
	Employee[Employee] = SelectedEmployee
)



VAR
	SelectedEmployee = SELECTEDVALUE(Employee[Employee])
RETURN

CALCULATE(
	SUM(BaseTable[Units])
	Employee[Employee] <> SelectedEmployee
)




Anonymous
Not applicable

Thank you. This solution works. I don't like that Power BI doesn't have a dynamic "set/group" solution because that would only be one variable, rather than one for each measure. But since it looks like they don't have this option, this is a good solution. Thanks!

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.

Top Solution Authors