Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hello All,
Iam working on migration project and have requirment like this:
In a table, i want to display different columns based on different conditions in single dax. For example, if condition-A becomes true , i need to display column1, if cond-2 is true, i want to display column2, if cond-3, column3.....This is working for pie chart visual, but not for table.
Pls let me know solution for this.
For refrence purpose, iam attaching the qlik expression here, which need to be converted to dax.
=if(GetSelectedCount(Direct) > 0 and GetSelectedCount(VP_Director) = 0 and GetSelectedCount(Director_Manager) = 0 and GetSelectedCount(Manager) = 0 , VP_Director, if( (GetSelectedCount(Direct) > 0 and GetSelectedCount(VP_Director) > 0 and GetSelectedCount(Director_Manager) = 0 and GetSelectedCount(Manager) = 0) or (GetSelectedCount(VP_Director) > 0 and GetSelectedCount(Direct) = 0 and GetSelectedCount(Director_Manager) = 0 and GetSelectedCount(Manager) = 0) , Director_Manager, if( (GetSelectedCount(Direct) > 0 and GetSelectedCount(VP_Director) > 0 and GetSelectedCount(Director_Manager) > 0 and GetSelectedCount(Manager) = 0) or (GetSelectedCount(VP_Director) = 0 and GetSelectedCount(Direct) > 0 and GetSelectedCount(Director_Manager) > 0 and GetSelectedCount(Manager) = 0) or (GetSelectedCount(VP_Director) > 0 and GetSelectedCount(Direct) = 0 and GetSelectedCount(Director_Manager) > 0 and GetSelectedCount(Manager) = 0) , Manager, if( (GetSelectedCount(Direct) > 0 and GetSelectedCount(VP_Director) > 0 and GetSelectedCount(Director_Manager) > 0 and GetSelectedCount(Manager) > 0) or (GetSelectedCount(VP_Director) = 0 and GetSelectedCount(Direct) > 0 and GetSelectedCount(Director_Manager) > 0 and GetSelectedCount(Manager) > 0) or (GetSelectedCount(VP_Director) > 0 and GetSelectedCount(Direct) = 0 and GetSelectedCount(Director_Manager) > 0 and GetSelectedCount(Manager) > 0) or (GetSelectedCount(VP_Director) = 0 and GetSelectedCount(Direct) = 0 and GetSelectedCount(Director_Manager) = 0 and GetSelectedCount(Manager) > 0) , SUBAREA_OWNER ))))
Hi @Anonymous ,
You could try the following DAX:
Column =
VAR a =
COUNT ( 'Table'[Direct] )
VAR b =
COUNT ( 'Table'[VP_Director] )
VAR c =
COUNT ( 'Table'[Director_Manager] )
VAR d =
COUNT ( 'Table'[Manager] )
RETURN
IF (
d > 0,
"SUBAREA_OWNER",
IF (
c > 0,
"Manager",
IF ( b > 0, "Director_Manager", IF ( a > 0, "VP_Director" ) )
)
)
@v-eachen-msft Thanks for the help. but this solution doesn't work for requirment
Hi @Anonymous ,
Try the following code (may need adjustments):
ttt =
SWITCH (
TRUE (),
COUNT ( Table[Direct] ) > 0
&& COUNT ( Table[VP_Director] ) = 0
&& COUNT ( Table[Director_Manager] ) = 0
&& COUNT ( Table[Manager] ) = 0, "VP_Director",
(
COUNT ( Table[Direct] ) > 0
&& COUNT ( Table[DirectVP_Director] ) > 0
&& COUNT ( Table[Director_Manager] ) = 0
&& COUNT ( Table[Manager] ) = 0
)
|| (
COUNT ( Table[VP_Director] ) > 0
&& COUNT ( Table[Direct] ) = 0
&& COUNT ( Table[Director_Manager] ) = 0
&& COUNT ( Table[Manager] ) = 0
), "Director_Manager",
(
COUNT ( Table[Direct] ) > 0
&& COUNT ( Table[VP_Director] ) > 0
&& COUNT ( Table[Director_Manager] ) > 0
&& COUNT ( Table[Manager] ) = 0
)
|| (
COUNT ( Table[VP_Director] ) = 0
&& COUNT ( Table[Direct] ) > 0
&& COUNT ( Table[Director_Manager] ) > 0
&& COUNT ( Table[Manager] ) = 0
)
|| (
COUNT ( Table[VP_Director] ) > 0
&& COUNT ( Table[Direct] ) = 0
&& COUNT ( Table[Director_Manager] ) > 0
&& COUNT ( Table[Manager] ) = 0
), "Manager",
(
COUNT ( Table[Direct] ) > 0
&& COUNT ( Table[VP_Director] ) > 0
&& COUNT ( Table[Director_Manager] ) > 0
&& COUNT ( Table[Manager] ) > 0
)
|| (
COUNT ( Table[VP_Director] ) = 0
&& COUNT ( Table[Direct] ) > 0
&& COUNT ( Table[Director_Manager] ) > 0
&& COUNT ( Table[Manager] ) > 0
)
|| (
COUNT ( Table[VP_Director] ) > 0
&& COUNT ( Table[Direct] ) = 0
&& COUNT ( Table[Director_Manager] ) > 0
&& COUNT ( Table[Manager] ) > 0
)
|| (
COUNT ( Table[VP_Director] ) = 0
&& COUNT ( Table[Direct] ) = 0
&& COUNT ( Table[Director_Manager] ) = 0
&& COUNT ( Table[Manager] ) > 0
), SUBAREA_OWNER
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
Can you please share a small smaple of your datafile?
Are this columns on your model? And what type of data do they have?
Direct, VP_Director, Director_Manager, Manager
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsJoin the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 79 | |
| 38 | |
| 31 | |
| 27 | |
| 27 |