Forum Discussion
DreamToGet
4 years agoFrequent Visitor
Filtering data via DAX
Hi all, I have a table and I am trying to identify devices based on the below conditions Failed Device - [OutputVolt < ReferenceVolt] in 'VOLT_MEAS', 'CURR_MEAS', 'FUNC_TEST', 'NON_FUNC' pro...
- 4 years ago
you can create a column
Column = VAR _volt=maxx(FILTER('Table','Table'[DeviceSerial]=EARLIER('Table'[DeviceSerial])&&'Table'[ProcessName]="VOLT_MEAS"),'Table'[[Output < Reference]]?]) VAR _curr=maxx(FILTER('Table','Table'[DeviceSerial]=EARLIER('Table'[DeviceSerial])&&'Table'[ProcessName]="CURR_MEAS"),'Table'[[Output < Reference]]?]) VAR _func=maxx(FILTER('Table','Table'[DeviceSerial]=EARLIER('Table'[DeviceSerial])&&'Table'[ProcessName]="FUNC_TEST"),'Table'[[Output < Reference]]?]) VAR _non=maxx(FILTER('Table','Table'[DeviceSerial]=EARLIER('Table'[DeviceSerial])&&'Table'[ProcessName]="NON_FUNC"),'Table'[[Output < Reference]]?]) VAR _config=maxx(FILTER('Table','Table'[DeviceSerial]=EARLIER('Table'[DeviceSerial])&&'Table'[ProcessName]="CONFIG_TEST"),'Table'[TestStatus]) return if(_volt="Yes"&&_curr="Yes"&&_func="Yes"&&_non="Yes"&&_config="Pass","Failed Device",if(_volt="Yes"&&_curr="Yes"&&_func="Yes"&&_non="Yes"&&(_config="Fail"||_config=""),"Did not pass/no record",if(_volt="No"&&_curr="No"&&_func="No"&&_non="No"&&_config="Pass","no issue")))what do you mean [OutputVolt < ReferenceVolt] in xxx? should match for all the process or any one process?
- 4 years ago
ryan_mayu: I have updated the DAX according to the logic and managed to get it working. Thank you very much for your inputs 🙂
Column = VAR _volt = MAXX ( FILTER ( 'Table', 'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] ) && 'Table'[ProcessName] = "VOLT_MEAS" ), 'Table'[[Output < Reference]]?] ) VAR _curr = MAXX ( FILTER ( 'Table', 'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] ) && 'Table'[ProcessName] = "CURR_MEAS" ), 'Table'[[Output < Reference]]?] ) VAR _func = MAXX ( FILTER ( 'Table', 'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] ) && 'Table'[ProcessName] = "FUNC_TEST" ), 'Table'[[Output < Reference]]?] ) VAR _non = MAXX ( FILTER ( 'Table', 'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] ) && 'Table'[ProcessName] = "NON_FUNC" ), 'Table'[[Output < Reference]]?] ) VAR _config = MAXX ( FILTER ( 'Table', 'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] ) && 'Table'[ProcessName] = "CONFIG_TEST" ), 'Table'[TestStatus] ) RETURN IF ( _volt = "No" && _curr = "No" && _func = "No" && _non = "No" && _config = "Pass", "no issue", IF ( ( _volt = "Yes" || _curr = "Yes" || _func = "Yes" || _non = "Yes" ) && _config = "Pass", "Failed Device", IF ( ( _volt = "No" || _curr = "No" || _func = "No" || _non = "No" ) && ( _config = "Fail" || _config = "" ), "Did not pass/no record", "BLANK" ) ) )
DreamToGet
4 years agoFrequent Visitor
ryan_mayu: I have updated the DAX according to the logic and managed to get it working. Thank you very much for your inputs 🙂
Column =
VAR _volt =
MAXX (
FILTER (
'Table',
'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] )
&& 'Table'[ProcessName] = "VOLT_MEAS"
),
'Table'[[Output < Reference]]?]
)
VAR _curr =
MAXX (
FILTER (
'Table',
'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] )
&& 'Table'[ProcessName] = "CURR_MEAS"
),
'Table'[[Output < Reference]]?]
)
VAR _func =
MAXX (
FILTER (
'Table',
'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] )
&& 'Table'[ProcessName] = "FUNC_TEST"
),
'Table'[[Output < Reference]]?]
)
VAR _non =
MAXX (
FILTER (
'Table',
'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] )
&& 'Table'[ProcessName] = "NON_FUNC"
),
'Table'[[Output < Reference]]?]
)
VAR _config =
MAXX (
FILTER (
'Table',
'Table'[DeviceSerial] = EARLIER ( 'Table'[DeviceSerial] )
&& 'Table'[ProcessName] = "CONFIG_TEST"
),
'Table'[TestStatus]
)
RETURN
IF (
_volt = "No"
&& _curr = "No"
&& _func = "No"
&& _non = "No"
&& _config = "Pass",
"no issue",
IF (
( _volt = "Yes"
|| _curr = "Yes"
|| _func = "Yes"
|| _non = "Yes" )
&& _config = "Pass",
"Failed Device",
IF (
( _volt = "No"
|| _curr = "No"
|| _func = "No"
|| _non = "No" )
&& ( _config = "Fail"
|| _config = "" ),
"Did not pass/no record",
"BLANK"
)
)
)
ryan_mayu
4 years agoSuper User
you are welcome