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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi there, I have the following problem:
I want a DAX script that makes a measure where is added the # of times SickHours> 0 = 1. So if 1 employee key is selected, for example, it will get the number of unique date keys where SickHours> 0 = 1. And if there for example 1 day is selected, I get the number of unique employee keys where Sick Hours> 0 = 1
| DateKey | EmployeeKey | SickHours > 0 |
| 4 | 1 | 1 |
| 4 | 2 | 0 |
| 4 | 3 | 0 |
| 4 | 1 | 1 |
| 16 | 1 | 0 |
| 16 | 2 | 1 |
| 16 | 3 | 1 |
| 390 | 1 | 1 |
| 390 | 3 | 1 |
Solved! Go to Solution.
Hi @Gjakova ,
Please refer to my .pbix file.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Gjakova ,
Like this?
Measure =
IF(
ISFILTERED(Sheet3[EmployeeKey]),
COUNTX(
FILTER( Sheet3, Sheet3[SickHours > 0] = 1 ),
[DateKey]
),
IF(
ISFILTERED(Sheet3[DateKey]),
COUNTX(
FILTER( Sheet3, Sheet3[SickHours > 0] = 1 ),
[EmployeeKey]
)
)
)
Or like this?
Measure 2 =
COUNTX(
FILTER( Sheet3, Sheet3[DateKey] = MAX(Sheet3[DateKey]) && Sheet3[EmployeeKey] = MAX(Sheet3[EmployeeKey]) && Sheet3[SickHours > 0] = 1 ),
[SickHours > 0]
)
If not, please show me the expected output result.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-lionel-msft I think your suggestion will work, I will try it out today. This is my expected output btw:
The SQL statement would look like this:
Hi @Gjakova ,
Please refer to my .pbix file.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Gjakova , Not very clear. Are looking for measure segmentation.
refer to my video: https://youtu.be/CuczXPj0N-k
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 103 | |
| 80 | |
| 59 | |
| 51 | |
| 46 |