Forum Discussion
Anonymous
2 years agoNot applicable
DAX comparison operations do not support comparing values of type Number with values of type Text.
Thank you all for the support.
- 2 years ago
Hello Anonymous,
Can you please try this approach:
context = SELECTCOLUMNS( 'Combined', "time_start", IF(ISBLANK('Combined'[_source.startedAt]) || FIND("@", 'Combined'[_source.startedAt], 1, 0) = 0, BLANK(), TIMEVALUE(LEFT(TRIM(MID('Combined'[_source.startedAt], FIND("@", 'Combined'[_source.startedAt]) + 2, LEN('Combined'[_source.startedAt]))), 8))), "time_end", IF(ISBLANK('Combined'[_source.endedAt]) || FIND("@", 'Combined'[_source.endedAt], 1, 0) = 0, BLANK(), TIMEVALUE(LEFT(TRIM(MID('Combined'[_source.endedAt], FIND("@", 'Combined'[_source.endedAt]) + 2, LEN('Combined'[_source.endedAt]))), 8))), "account_id", FORMAT('Combined'[_source.accountId], "0"), -- Convert account ID to text "transact_status", SWITCH( TRUE(), CONTAINSSTRING('Combined'[_source.status], "FAILED_client"), "Client failed", CONTAINSSTRING('Combined'[_source.status], "SUCCESS_"), "Transaction succeeded", CONTAINSSTRING('Combined'[_source.status], "pending"), "Transaction Pending", CONTAINSSTRING('Combined'[_source.status], "gateway_"), "Pending at Gateway", CONTAINSSTRING('Combined'[_source.status], "FAILED_finish"), "Transaction failed", CONTAINSSTRING('Combined'[_source.status], "aborted_"), "Client aborted", CONTAINSSTRING('Combined'[_source.status], "wallet_"), "Pending from wallet", BLANK() ), "Date", VAR DatePart = LEFT('Combined'[_source.startedAt], SEARCH("@", 'Combined'[_source.startedAt]) - 2) RETURN IF(ISERROR(DATEVALUE(DatePart)), BLANK(), DATEVALUE(DatePart)), "subscription", 'Combined'[_source.cardTransactionMetaData.verifiedMerchant.isSubscription], "source_fee", VALUE('Combined'[_source.feeDetail.sourceFee.amount]), "free_limit_amount", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.destinationFee.freeLimitAmount])), 0), "VAT_total_revenue", IFERROR(VALUE(TRIM('Combined'[_source.cardMetaData.totalVATAmount])), 0), "govt_fees", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.sourceFee.governmentFee.fee])), 0), "product_fee", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.destinationFee.conversion.productFeeAmount])), 0), "feeVAT", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.sourceFee.feeVATAmount])), 0), "margin", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.sourceFee.margin])), 0), "total_amount", IFERROR(VALUE(TRIM('Combined'[_source.totalAmount])), 0) -- Continue adding fields with similar logic as required )Hope this helps.
Sahir_Maharaj
Super User
2 years agoHello Anonymous,
Can you please try this approach:
context =
SELECTCOLUMNS(
'Combined',
"time_start", IF(ISBLANK('Combined'[_source.startedAt]) || FIND("@", 'Combined'[_source.startedAt], 1, 0) = 0, BLANK(), TIMEVALUE(LEFT(TRIM(MID('Combined'[_source.startedAt], FIND("@", 'Combined'[_source.startedAt]) + 2, LEN('Combined'[_source.startedAt]))), 8))),
"time_end", IF(ISBLANK('Combined'[_source.endedAt]) || FIND("@", 'Combined'[_source.endedAt], 1, 0) = 0, BLANK(), TIMEVALUE(LEFT(TRIM(MID('Combined'[_source.endedAt], FIND("@", 'Combined'[_source.endedAt]) + 2, LEN('Combined'[_source.endedAt]))), 8))),
"account_id", FORMAT('Combined'[_source.accountId], "0"), -- Convert account ID to text
"transact_status", SWITCH(
TRUE(),
CONTAINSSTRING('Combined'[_source.status], "FAILED_client"), "Client failed",
CONTAINSSTRING('Combined'[_source.status], "SUCCESS_"), "Transaction succeeded",
CONTAINSSTRING('Combined'[_source.status], "pending"), "Transaction Pending",
CONTAINSSTRING('Combined'[_source.status], "gateway_"), "Pending at Gateway",
CONTAINSSTRING('Combined'[_source.status], "FAILED_finish"), "Transaction failed",
CONTAINSSTRING('Combined'[_source.status], "aborted_"), "Client aborted",
CONTAINSSTRING('Combined'[_source.status], "wallet_"), "Pending from wallet",
BLANK()
),
"Date", VAR DatePart = LEFT('Combined'[_source.startedAt], SEARCH("@", 'Combined'[_source.startedAt]) - 2)
RETURN IF(ISERROR(DATEVALUE(DatePart)), BLANK(), DATEVALUE(DatePart)),
"subscription", 'Combined'[_source.cardTransactionMetaData.verifiedMerchant.isSubscription],
"source_fee", VALUE('Combined'[_source.feeDetail.sourceFee.amount]),
"free_limit_amount", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.destinationFee.freeLimitAmount])), 0),
"VAT_total_revenue", IFERROR(VALUE(TRIM('Combined'[_source.cardMetaData.totalVATAmount])), 0),
"govt_fees", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.sourceFee.governmentFee.fee])), 0),
"product_fee", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.destinationFee.conversion.productFeeAmount])), 0),
"feeVAT", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.sourceFee.feeVATAmount])), 0),
"margin", IFERROR(VALUE(TRIM('Combined'[_source.feeDetail.sourceFee.margin])), 0),
"total_amount", IFERROR(VALUE(TRIM('Combined'[_source.totalAmount])), 0)
-- Continue adding fields with similar logic as required
)
Hope this helps.