Forum Discussion
MAAbdullah47
Helper V
9 years agoCreating conditional column based on time for another column
Dear All I created 3 global variables with name: Morning, Noon and evening and I set default values '11:00' ,'16:00' and '23:59' for each variable respectively. Now I need to add new condition ...
Eric_Zhang
Microsoft Employee
9 years ago
MAAbdullah47 wrote:
Ok I got it, but There is an error said:
"DAX comparison operations do not support comparing values of type Text with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values."
What is the type of "orders.opened_at", I think it is a TEXT type, that's why you get such error.
Try to convert it to a Date/Time type and apply
Meal = IF(HOUR('order product'[orders.opened_at])<11,"Breakfast",IF(HOUR('order product'[orders.opened_at])<18,"Lunch","Dinner"))
You'll do more conversion work if "orders.opened_at" is not a valid date format text.
MAAbdullah47
Helper V
9 years agoLet me know how to convert the column into date time, I found many difficulties without clear instructions for altering the data type, I'll be appreciated if you can help me.