Forum Discussion
MAAbdullah47
9 years agoHelper V
Creating 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 ...
Greg_Deckler
9 years agoCommunity Champion
Are you doing this in Power Query (M) code or in the data model and want to use DAX?
- MAAbdullah479 years agoHelper V
The User group moved and I couldn't found the answer.
- Greg_Deckler9 years agoCommunity Champion
Here is one way and you do not need any kind of global variable or anything, just a calculated column like this:
Column = IF([Time]<TIME(11,0,0),"Morning",IF([Time]<TIME(16,0,0),"Noon","Evening"))
You could modify this to just do less than 16:00:00 be Lunch, otherwise "Dinner".
- MAAbdullah479 years agoHelper V
Thank you but I still don't know where I put this command when I create a new field (conditional column)?