Forum Discussion
reynold522
3 years agoHelper II
error code in dax
Hi all, we have installed a lot of IoT devices in US and EU, I would like to check if minimum voltage of devices installed in US insider range: 5V -12V minimum voltage of devices installed in EU...
- 3 years ago
Try
MinVoltageN = IF ( ISINSCOPE ( TRACKSHEET[REGION] ), VAR _minV = MIN ( datatable[VOLTAGE] ) VAR _showminvoltage = SWITCH ( TRUE (), VALUES ( TRACKSHEET[REGION] ) = "EU" && _minV < 9 && _minV > 5, 1, VALUES ( TRACKSHEET[REGION] ) = "US" && _minV < 12 && _minV > 5, 1, BLANK () ) -- Notification VAR _Notificationminvol = IF ( _showminvoltage, 1, 0 ) RETURN _Notificationminvol )
johnt75
3 years agoSuper User
My guess is that the problem was triggered in the total line of a table or matrix value. If the region wasn't filtered down to a single value, as would be the case for a total, then VALUES will return all the regions as a table, and you can't compare a table with multiple rows with a scalar value. By checking ISINSCOPE you are guaranteeing that there will be only 1 value returned and so you can compare that to a scalar value.
reynold522
3 years agoHelper II
thank you very much