Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi team,
I have the following calculated column (DAX):
Shift = IF(AND('Table'[Time]>=TIMEVALUE("12:00 AM"),'Table'[Time]<TIMEVALUE("7:00 AM")),"N",IF(AND('Table'[Time]>=TIMEVALUE("7:00 AM"),'Table[Time]<TIMEVALUE("2:00 PM")),"D",IF(AND('Table'[Time]>=TIMEVALUE("2:00 PM"),'Table'[Time]<TIMEVALUE("5:00 PM")),"B","A")))
I would like to add new column (representing the same DAX formula requirements) in the Advanced query source code (Power M).
Can you help me transforming the dax formula into power m code?
Thank you.
Solved! Go to Solution.
@Anonymous , My bad in power query and is and not &&
if [Time] >= #time(0,0,0) and [Time] < #time(7,0,0) then "N"
else if [Time] >= #time(7,0,0) and [Time] < #time(14,0,0) then "D"
else if [Time] >= #time(14,0,0) and [Time] < #time(17,0,0) then "B" else "A"
@Anonymous , Try like
if [Time] >= #time(0,0,0) && [Time] < #time(7,0,0) then "N"
else if [Time] >= #time(7,0,0) && [Time] < #time(14,0,0) then "D"
else if [Time] >= #time(14,0,0) && [Time] < #time(17,0,0) then "B" else "A"
Hi @amitchandak,
Thank you for your response. I tried to create a custom column with the suggested code, but I received an error "Token Literal expected" and the letter 'm' in column [Time] was underlined.
I know that this error means that the next thing in the formula is expected to be a value, column name, or a function, and in my case is a column name (with type 'time'). Do you have any ideas how can I edit this code in order to remove the error?
Thanks.
@Anonymous , My bad in power query and is and not &&
if [Time] >= #time(0,0,0) and [Time] < #time(7,0,0) then "N"
else if [Time] >= #time(7,0,0) and [Time] < #time(14,0,0) then "D"
else if [Time] >= #time(14,0,0) and [Time] < #time(17,0,0) then "B" else "A"
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.