Forum Discussion
IF Statement for a column not working
- 4 years ago
Hi Anonymous ,
Thanks for the data! I think I got to a solution:
I did it in two steps but both steps are already incorporated in the measure below. First, I created the column TomsRolling4Column which returns the 4 month window for each User ID (see picture above) This equals everything in the FILTER statement below (in green). Afterwards, we only need to distinct count all User IDs which have a number >= 9 in the new column (blue below).
TomsRolling4Measure = CALCULATE ( DISTINCTCOUNT ( Table[User ID] ), FILTER ( Table, CALCULATE ( SUM (Table[Sickness Amount (Days)] ), ALLEXCEPT ( Table, Table[User ID] ), DATESINPERIOD( Table[Sickness Date], Table[Sickness Date], -4, MONTH ) ) >= 9 ) )Please try it and let me know if it works 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Hi Anonymous ,
Thanks for the data! I think I got to a solution:
I did it in two steps but both steps are already incorporated in the measure below. First, I created the column TomsRolling4Column which returns the 4 month window for each User ID (see picture above) This equals everything in the FILTER statement below (in green). Afterwards, we only need to distinct count all User IDs which have a number >= 9 in the new column (blue below).
TomsRolling4Measure =
CALCULATE (
DISTINCTCOUNT ( Table[User ID] ),
FILTER (
Table,
CALCULATE (
SUM (Table[Sickness Amount (Days)] ),
ALLEXCEPT ( Table, Table[User ID] ),
DATESINPERIOD(
Table[Sickness Date],
Table[Sickness Date],
-4, MONTH
)
) >= 9
)
)
Please try it and let me know if it works 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/