Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |