Join 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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
How do I write a DAX measure based on a condition on 'TYPE' column? If TYPE = P, then count distinct employee IDs times .33 else just diplay count distinct employees. This measure will be used on a layout that will not have the 'TYPE' column in it.
TYPE | EMP COUNT DISTINCT | DESIRED - EMP COUNT DISTINCT |
F | 200 | 200 |
P | 50 | 16.50 |
Solved! Go to Solution.
@Anonymous ,
try this
Emp count distinct =
VAR _disctinctCount = DISTINCTCOUNT('Sample Table'[employeeID])
VAR _result = IF(SELECTEDVALUE('Sample Table'[Type]) = "P",_disctinctCount*0.33,_disctinctCount)
RETURN _result
Thanks,
Arul
Hello @Arul and the forum!
When the 'Type' column is not being used on the layout. The measure is not doing the math. Therefore, I resolved the issue with the dax code below.
Active FTEs (Cal_2) =
VAR _P =
CALCULATE (
DISTINCTCOUNT ( EMP_TRAN_FACT[HR Employee ID] ),
EMP_TRAN_FACT[HR Employee Event Type] = "ACTIVE"
&& EMP_TRAN_FACT[HR Employee Job Type] = "P"
)
VAR _F =
CALCULATE (
DISTINCTCOUNT ( EMP_TRAN_FACT[HR Employee ID] ),
EMP_TRAN_FACT[HR Employee Event Type] = "ACTIVE"
&& EMP_TRAN_FACT[HR Employee Job Type] = "F"
)
RETURN
CALCULATE (
SUMX (
VALUES ( EMP_TRAN_FACT[HR Employee Job Type] ),
IF ( EMP_TRAN_FACT[HR Employee Job Type] = "P", _P * 0.33, _F )
)
)
Hello @Arul and the forum!
When the 'Type' column is not being used on the layout. The measure is not doing the math. Therefore, I resolved the issue with the dax code below.
Active FTEs (Cal_2) =
VAR _P =
CALCULATE (
DISTINCTCOUNT ( EMP_TRAN_FACT[HR Employee ID] ),
EMP_TRAN_FACT[HR Employee Event Type] = "ACTIVE"
&& EMP_TRAN_FACT[HR Employee Job Type] = "P"
)
VAR _F =
CALCULATE (
DISTINCTCOUNT ( EMP_TRAN_FACT[HR Employee ID] ),
EMP_TRAN_FACT[HR Employee Event Type] = "ACTIVE"
&& EMP_TRAN_FACT[HR Employee Job Type] = "F"
)
RETURN
CALCULATE (
SUMX (
VALUES ( EMP_TRAN_FACT[HR Employee Job Type] ),
IF ( EMP_TRAN_FACT[HR Employee Job Type] = "P", _P * 0.33, _F )
)
)
@Anonymous ,
try this
Emp count distinct =
VAR _disctinctCount = DISTINCTCOUNT('Sample Table'[employeeID])
VAR _result = IF(SELECTEDVALUE('Sample Table'[Type]) = "P",_disctinctCount*0.33,_disctinctCount)
RETURN _result
Thanks,
Arul
Thanks a lot @Arul . Works perfectly! Learnt something new today 🙂
I just had to tweak the first variable to filter the data.
VAR _disctinctCount = CALCULATE(DISTINCTCOUNT('Sample Table'[employeeID]), 'Sample Table'[Column] in {"abc", "xyz"})
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.