0

I want to create a conditional column using DAX, which compares 2 date columns and a status column that derives a condition.

I have tried this code:

Status of Feedback =
IF (
    ISBLANK ( 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[ProcConfm_CompdDate] )
        || 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[DatePlus20] > 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[Present Day]
            && ISBLANK ( 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[ProcsAccptce_Status] ),
    "Audit<20days",
    0
)

But I am getting the following error: Expressions that yield variant data-type cannot be used to define calculated columns.

Is there any way I can achieve what I need?

1 Answer 1

0

You cannot have an IF block that for TRUE yields one data type (e.g. STRING) and for FALSE yields another (e.g. INTEGER) - this is what is referred to in the error as expressions that yield variant data-type. In other words, the problem is not the columns you are using in your condition statement, but what you have assigned to be the output of this function.

Try this:

Status of Feedback =
IF (
    ISBLANK ( 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[ProcConfm_CompdDate] )
        || 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[DatePlus20] > 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[Present Day]
            && ISBLANK ( 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[ProcsAccptce_Status] ),
    "Audit<20days",
    "0"
)

Or leave out the FALSE block entirely:


Status of Feedback =
IF (
    ISBLANK ( 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[ProcConfm_CompdDate] )
        || 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[DatePlus20] > 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[Present Day]
            && ISBLANK ( 'DAT IndAudPlan_IntSys_FindgMgmt_Findgs_RA_5Whys'[ProcsAccptce_Status] ),
    "Audit<20days"
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.