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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.