Forum Discussion
ksmith0411
4 years agoRegular Visitor
Switch function
Hi, Im trying to do a swicth query between two times ie if Start time >=08:00:00 & End time <=09:00:00 then return 09:00:00 but im not having any joy If anyone can help that woul dbe great. ...
- 4 years ago
Hi ksmith0411 ,
Whether you need to save the first row as variable which named 'Hour_Part' and create the calculated column like this:
Column 2 = VAR Hour_Part = TIME ( HOUR ( Actual[Start Time] ), MINUTE ( Actual[Start Time] ), SECOND ( Actual[Start Time] ) ) RETURN SWITCH ( TRUE (), Hour_Part > TIME ( 8, 0, 0 ) && Hour_Part < TIME ( 9, 0, 0 ), TIME ( 9, 0, 0 ) )Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Try it this way--assume your prior step is named PriorStep:
= Table.AddColumn(PriorStep, "Next Hour", each Time.StartOfHour(Time.From([End Time] + #duration(0,1,0,0))))
--Nate
ksmith0411
4 years agoRegular Visitor
HI Nate,
Thanks for coming back to me, Im afraid Im a complete novice on power BI ive tried this but think I'm entering it in wrong.
Thanks
K