This is best explained with an example. We have a daily error file that shows vouchers that have exceptions. A single voucher line can generate multiple errors. Sometimes this is because there were multiple things wrong with it, and sometimes because a single root cause can throw multiple errors.
Certain error combinations (e.g. P400 and E110) are known to be a result of a single cause. A P400 can also occur on its own. I would like to be able to identify such rows and route them for resolution. In the example below vouchers 456 and 789 would be routed for resolution.
I am assuming that a calculated column is the best way to do this but I'm getting confused on the DAX I would enter into Test Column.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Voucher[/TD]
[TD]Error[/TD]
[TD]Test Column[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]R500[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]P400[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]E110[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]P400[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]E110[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]789[/TD]
[TD]P400[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]E110[/TD]
[TD]N[/TD]
[/TR]
</tbody>[/TABLE]
I had initially though of a FILTER construct, but this logic would also return any value where there might be more than the P400 and E110 errors as well as the E110 errors alone. (I would separately filter by P400 in the pivot table so the other voucher lines that returned 0 because they didn't have any P400 errors.)
I'm not sure if I need some sort of CONCATENATEX to check which errors were returned. Your help is appreciated!
Certain error combinations (e.g. P400 and E110) are known to be a result of a single cause. A P400 can also occur on its own. I would like to be able to identify such rows and route them for resolution. In the example below vouchers 456 and 789 would be routed for resolution.
I am assuming that a calculated column is the best way to do this but I'm getting confused on the DAX I would enter into Test Column.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Voucher[/TD]
[TD]Error[/TD]
[TD]Test Column[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]R500[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]P400[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]E110[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]P400[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]E110[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]789[/TD]
[TD]P400[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]E110[/TD]
[TD]N[/TD]
[/TR]
</tbody>[/TABLE]
I had initially though of a FILTER construct, but this logic would also return any value where there might be more than the P400 and E110 errors as well as the E110 errors alone. (I would separately filter by P400 in the pivot table so the other voucher lines that returned 0 because they didn't have any P400 errors.)
Code:
=IF (
CALCULATE (
COUNTROWS ( 'Match Exception' ),
FILTER (
'Match Exception',
'Match Exception'[ME_Key] = EARLIER ( 'Match Exception'[ME_Key] )
&& ( 'Match Exception'[Rule] = "P400"
|| 'Match Exception'[Rule] = "E110" )
)
) < 2,
"Y",
"N"
)
I'm not sure if I need some sort of CONCATENATEX to check which errors were returned. Your help is appreciated!