Forum Discussion
Anonymous
5 years agoNot applicable
Multiple IF statements
HI There, I'm trying to create a column with multiple if statements based on a due date. I have created a column with todays date as Today's Date = now() So my expression so far is which works ...
- 5 years ago
Anonymous Well, you could do this but I would recommend using a SWITCH(TRUE() statement instead:
Due Status = if( [Today's Date].[Date]-[Due Date].[Date]>0, "Overdue", IF( [Today's Date].[Date]-[Due Date].[Date]=0, "Due Today", IF( <third condition>, <if true>, "Not Overdue" ) ) ) Due Status Alt = SWITCH(TRUE(), ([Today's Date].[Date]-[Due Date].[Date])>0,"Overdue", ([Today's Date].[Date]-[Due Date].[Date])=0,"Due Today", <third condition>, <if true>, "Not Overdue" )
Greg_Deckler
Community Champion
5 years agoAnonymous Well, you could do this but I would recommend using a SWITCH(TRUE() statement instead:
Due Status =
if(
[Today's Date].[Date]-[Due Date].[Date]>0,
"Overdue",
IF(
[Today's Date].[Date]-[Due Date].[Date]=0,
"Due Today",
IF(
<third condition>,
<if true>,
"Not Overdue"
)
)
)
Due Status Alt =
SWITCH(TRUE(),
([Today's Date].[Date]-[Due Date].[Date])>0,"Overdue",
([Today's Date].[Date]-[Due Date].[Date])=0,"Due Today",
<third condition>, <if true>,
"Not Overdue"
)- Anonymous5 years agoNot applicable
Ok Cool - I'll try that - thanks heaps
- Anonymous4 years agoNot applicable
Here is my DAX:
Step1 = IF(DL_FYTD_SALES_AUM_VW[FYTD_CORP_MONTH_YEAR] == MAX(DL_FYTD_SALES_AUM_VW[FYTD_CORP_MONTH_YEAR]),"Current Month",IF( DL_FYTD_SALES_AUM_VW[FYTD_CORP_MONTH_YEAR] == MAX(DL_FYTD_SALES_AUM_VW[FYTD_CORP_MONTH_YEAR])-1,"Prior Month", "History Month"))I got the below error:
DAX comparison operations do not support comparing values of type Text with values of type Number. Consider using the VALUE or FORMAT function to convert one of the values.