Forum Discussion
DAX IF Statement producing errors highlighted in red font
Hi,
I have this written this DAX code but its producing the red error bar as per screenshot and I'm not sure why?
Also, could this be better written using Variables possibly?
Into Area Date = if('Cases - Active'[Functional Area] = "Assessment", 'Cases - Active'[tpo_legacycasecreationdate],if('Cases - Active'[Functional Area] = "Casework Support", 'Cases - Active'[new_allocationqueuecaseworksupport], if('Cases - Active'[Functional Area] = "Adjudication", 'Cases - Active'[tpo_datepassedtoadjudication], if('Cases - Active'[Functional Area] = "Early Resolution", 'Cases - Active'[tpo_dateofertacceptance], if('Cases - Active'[Functional Area] = "Assessment" && 'Cases - Active'[Sub Area] = "Assessment Post ERT", 'Cases - Active'[tpo_datepassedfromearlyresolution],0)))))
Thanks,
ArchStanton
Yes sir, if you have got the correct results already then don't worry about it.
9 Replies
- tamerj1
Community Champion
Hi ArchStanton
Please tryInto Area Date = VAR FunctionalArea = 'Cases - Active'[Functional Area] VAR SubArea = 'Cases - Active'[Sub Area] RETURN SWITCH ( TRUE, FunctionalArea = "Assessment", 'Cases - Active'[tpo_legacycasecreationdate], FunctionalArea = "Casework Support", 'Cases - Active'[new_allocationqueuecaseworksupport], FunctionalArea = "Adjudication", 'Cases - Active'[tpo_datepassedtoadjudication], FunctionalArea = "Early Resolution", 'Cases - Active'[tpo_dateofertacceptance], FunctionalArea = "Assessment" && SubArea = "Assessment Post ERT", 'Cases - Active'[tpo_datepassedfromearlyresolution], 0 ) - ArchStanton
Power Participant
Thanks, writing it like this is definitely easier to understand or possibly debug in future.
The DAX still produces errors though:
- tamerj1
Community Champion
ArchStanton
What does the error say? Are you sure you are creating a calculated column not a measure?- ArchStanton
Power Participant
I'm still learning PowerBI so please bare with me.
I can't see an error message but In the right hand corner this RED box appears when I go to the end of the code on line 14:
(and the FunctionalArea names are all in Red Font - does that not sugeest a problem)?
This is a new column that will contain only dates that I will use on my visuals.
Hope that makes sense?