Forum Discussion
nelson777
4 years agoFrequent Visitor
Calculation with true/ false statment
Hi there, I have a measure with a condition that returns me 1 for TRUE and 0 for FALSE. What do I do, to sum up, all the 1 (True) results? The condition works with this logic: if the amount of ...
- 4 years ago
Hi nelson777
You may tryMeasure1 = SUMX ( VALUES ( d_time[Hour Num] ), CALCULATE ( VAR Client = MAX ( d_clients[Client Full Name] ) VAR devices_per_client = CALCULATE ( DISTINCTCOUNT ( d_devices[Device] ), d_clients[Client Full Name] = Client ) VAR Alerts = CALCULATE ( [Alerts], VALUES ( f_alerts[Start Date] ) ) VAR Tag = IF ( Alerts >= devices_per_client, 1, 0 ) RETURN Tag ) )
tamerj1
4 years agoCommunity Champion
Hi nelson777
You may try
Measure1 =
SUMX (
VALUES ( d_time[Hour Num] ),
CALCULATE (
VAR Client =
MAX ( d_clients[Client Full Name] )
VAR devices_per_client =
CALCULATE (
DISTINCTCOUNT ( d_devices[Device] ),
d_clients[Client Full Name] = Client
)
VAR Alerts =
CALCULATE ( [Alerts], VALUES ( f_alerts[Start Date] ) )
VAR Tag =
IF ( Alerts >= devices_per_client, 1, 0 )
RETURN
Tag
)
)