Forum Discussion
Anonymous
5 years agoNot applicable
Dax Issue
Hi Everyone In this screenshot customer order initiated and payment success is in same txn id we want transaction completed or else customer is only order initiated we want payment failed....
- 5 years ago
Hi,Anonymous
According to your description,I think you can create a column to calculate the desired result,like this:
Column = VAR a = CALCULATETABLE ( DISTINCT ( 'Table'[TXN-OID] ), FILTER ( ALL ( 'Table' ), [TXN-STATUS] = "ORDER_INITIATED" ) ) VAR c = CALCULATETABLE ( DISTINCT ( 'Table'[TXN-OID] ), FILTER ( ALL ( 'Table' ), [TXN-STATUS] = "PAYMENT_SUCCESS" ) ) RETURN IF ( [TXN-OID] IN a && [TXN-OID] IN c, "completed", "payment failed" )OR:
Column 2 = VAR a = COUNTROWS ( FILTER ( 'Table', [TXN-OID] = EARLIER ( 'Table'[TXN-OID] ) && [TXN-STATUS] = "ORDER_INITIATED" ) ) VAR b = COUNTROWS ( FILTER ( 'Table', [TXN-OID] = EARLIER ( 'Table'[TXN-OID] ) && [TXN-STATUS] = "PAYMENT_SUCCESS" ) ) RETURN IF ( b > 0 && a > 0, "completed", "payment failed" )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-janeyg-msft
5 years agoCommunity Support
Hi,Anonymous
According to your description,I think you can create a column to calculate the desired result,like this:
Column =
VAR a =
CALCULATETABLE (
DISTINCT ( 'Table'[TXN-OID] ),
FILTER ( ALL ( 'Table' ), [TXN-STATUS] = "ORDER_INITIATED" )
)
VAR c =
CALCULATETABLE (
DISTINCT ( 'Table'[TXN-OID] ),
FILTER ( ALL ( 'Table' ), [TXN-STATUS] = "PAYMENT_SUCCESS" )
)
RETURN
IF ( [TXN-OID] IN a && [TXN-OID] IN c, "completed", "payment failed" )OR:
Column 2 =
VAR a =
COUNTROWS (
FILTER (
'Table',
[TXN-OID] = EARLIER ( 'Table'[TXN-OID] )
&& [TXN-STATUS] = "ORDER_INITIATED"
)
)
VAR b =
COUNTROWS (
FILTER (
'Table',
[TXN-OID] = EARLIER ( 'Table'[TXN-OID] )
&& [TXN-STATUS] = "PAYMENT_SUCCESS"
)
)
RETURN
IF ( b > 0 && a > 0, "completed", "payment failed" )
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.