Forum Discussion
additional condition in the dax code
- 5 years ago
Hi jitpbi ,
Sorry to reply late. Try to change the expression like so:
VAR tab = FILTER ( 'Table', TIME ( HOUR ( 'Table'[DateTime] ), MINUTE ( 'Table'[DateTime] ), SECOND ( 'Table'[DateTime] ) ) >= TIME ( 9, 30, 0 ) && TIME ( HOUR ( 'Table'[DateTime] ), MINUTE ( 'Table'[DateTime] ), SECOND ( 'Table'[DateTime] ) ) <= TIME ( 17, 30, 0 ) && 'Table'[Count of Anomaly] = 1 ----------added )Or you can add "[Count of Anomaly] = 1" at each var count like so:
VAR currentcount = COUNTROWS ( FILTER ( tab, DATE(YEAR([DateTime]),MONTH([DateTime]),DAY([DateTime])) = TODAY () ) && [Count of Anomaly] = 1 )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi amitchandak ,
The above code is working fine for the detailed requirement. I only need to add one more condition to this code.
Adding conditional formatting doesnt work for my entire requirement.
Thanks
Hi jitpbi ,
Additonal condition: If the field "Actual" has value 0 then it should display with a grey colour.
If it means that in each cell of the Matrix visual, at least one of all the 'Actual' values is 0. Or in other words, the minimum value is 0. Then add another condition like this:
count =
VAR tab =
xxxxx
VAR currentcount =
xxxxx
VAR p1 =
xxxxx
VAR p2 =
xxxxxx
VAR p3 =
xxxxxx
VAR p4 =
xxxxxx
VAR p5 =
xxxxxx
RETURN
IF (
MIN ( 'Table'[Actual] ) = 0,
UNICHAR ( 9898 ),
SWITCH (
xxxxxxx
)
)
If it means that in each cell of the Matrix visual, the sum value is 0. Then add another condition like this:
count =
VAR tab =
xxxxx
VAR currentcount =
xxxxx
VAR p1 =
xxxxx
VAR p2 =
xxxxxx
VAR p3 =
xxxxxx
VAR p4 =
xxxxxx
VAR p5 =
xxxxxx
RETURN
IF (
SUM ( 'Table'[Actual] ) = 0,
UNICHAR ( 9898 ),
SWITCH (
xxxxxxx
)
)
Please let me know if I understand incorrectly.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.