Forum Discussion
Nepal101
Helper III
2 years agoSwitch (true() formula not working
Hello everyone,
can someone help me with the Switch formula I am having an error when creating the logic.
Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values. ( This is the error that poped up)
Quaterdisplay = SWITCH(true(),
'calculation'[Quatervalue]="Q1" && 'calculation'[SelectionDate]=BLANK(),"Q1","Q2",
'calculation'[Quatervalue]="Q2" && 'calculation'[SelectionDate]=BLANK(),"Q2","Q3",
'calculation'[Quatervalue]="Q3" && 'calculation'[SelectionDate]=BLANK(),"Q3","Q4",
'calculation'[Quatervalue]="Q4" && 'calculation'[SelectionDate]=BLANK(),"Q4","Q1"
)
When I tried to create this column the other column gets and error too not sure why that is below is the snapshot of the query
Thank you for helping and taking a look at this.
When I tried to create this column the other column gets and error too not sure why that is below is the snapshot of the query
Recommended = SWITCH(true(),
'calculation'[Quater max]=1 && ('calculation'[SelectionDate]=BLANK()),[Q1],[Q2] ||
'calculation'[Quater max]=2 && ( 'calculation'[SelectionDate]=BLANK()),[Q2],[Q3]||
'calculation'[Quater max]=2 && ( 'calculation'[SelectionDate]=BLANK()),[Q3],[Q4]||
'calculation'[Quater max]=2 && ( 'calculation'[SelectionDate]=BLANK()),[Q4],[Q1])
Thank you for helping and taking a look at this.
you have too many values in each of the rows.
Quaterdisplay = SWITCH(true(), 'calculation'[Quatervalue]="Q1" && ISBLANK('calculation'[SelectionDate]),"Q1", 'calculation'[Quatervalue]="Q2" && ISBLANK('calculation'[SelectionDate]),"Q2", 'calculation'[Quatervalue]="Q3" && ISBLANK('calculation'[SelectionDate]),"Q3", 'calculation'[Quatervalue]="Q4" && ISBLANK('calculation'[SelectionDate]),"Q4" )
1 Reply
- lbendlin
Super User
you have too many values in each of the rows.
Quaterdisplay = SWITCH(true(), 'calculation'[Quatervalue]="Q1" && ISBLANK('calculation'[SelectionDate]),"Q1", 'calculation'[Quatervalue]="Q2" && ISBLANK('calculation'[SelectionDate]),"Q2", 'calculation'[Quatervalue]="Q3" && ISBLANK('calculation'[SelectionDate]),"Q3", 'calculation'[Quatervalue]="Q4" && ISBLANK('calculation'[SelectionDate]),"Q4" )