Forum Discussion
Creating conditional column based on time for another column
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.
I got now how to change the text into (Date/Time) but when I try to change the type it gives the following message error:
"We can't Automatically convert the column to Date/Time Type", any advice?
- Eric_Zhang9 years agoMicrosoft Employee
MAAbdullah47 wrote:
I got now how to change the text into (Date/Time) but when I try to change the type it gives the following message error:
"We can't Automatically convert the column to Date/Time Type", any advice?
The error shows there're some text in that column not in a valid date format in your data, would you mind sharing any sample data in your case?
- MAAbdullah479 years agoHelper V
Hold On I'll try to send you the column information only, but here I cannot send it as an attachment, so what I should do?
- Eric_Zhang9 years agoMicrosoft Employee
MAAbdullah47 wrote:
Hold On I'll try to send you the column information only, but here I cannot send it as an attachment, so what I should do?
You can post it as plain text or upload the attachment to a network driver(Onedrive, Google Drive or any) and share the download link.