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?
You cannot have an
IF
block that forTRUE
yields one data type (e.g.STRING
) and forFALSE
yields another (e.g.INTEGER
) - this is what is referred to in the error as expressions thatyield 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:
Or leave out the
FALSE
block entirely: