Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Plese excuse my newbie question.
I am trying to get power query to be able to do an IF THEN ELSE using the comaprison of a duration field to a fixed value - if duration is greater than 6 hours, yes else no. I have tried
Add Column -> Custom Column -> If [duration column] > "0.05.00.00" then "yes" else "no" The 0.05:00:00 I what I am guessing would be 5 hours for the fixed value. Am I even close?
Solved! Go to Solution.
Assuming your [duration colum] has a duration data type, you need to use this syntax to hard code a duration value
if [duration column] > #duration(0,5,0,0) then "yes" else "no"
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Anonymous ,
I think you can take a look at bleow links which about duration.
Reference:
Function | Description |
---|---|
Duration.Days | Returns the day component of a Duration value. |
Duration.From | Returns a duration value from a value. |
Duration.FromText | Returns a Duration value from a text value. |
Duration.Hours | Returns an hour component of a Duration value. |
Duration.Minutes | Returns a minute component of a Duration value. |
Duration.Seconds | Returns a second component of a Duration value. |
Duration.ToRecord | Returns a record with parts of a Duration value. |
Duration.TotalDays | Returns the total magnitude of days from a Duration value. |
Duration.TotalHours | Returns the total magnitude of hours from a Duration value. |
Duration.TotalMinutes | Returns the total magnitude of minutes from a Duration value. |
Duration.TotalSeconds | Returns the total magnitude of seconds from a duration value. |
For instance:
Duration.Second([Datetime Column]) //get the second value(0~59) of datetime
Duration.TotalSeconds([Datetime Column]) //convert datetime value to second
Sample: get the diff of date range and convert them to second.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I think you can take a look at bleow links which about duration.
Reference:
Function | Description |
---|---|
Duration.Days | Returns the day component of a Duration value. |
Duration.From | Returns a duration value from a value. |
Duration.FromText | Returns a Duration value from a text value. |
Duration.Hours | Returns an hour component of a Duration value. |
Duration.Minutes | Returns a minute component of a Duration value. |
Duration.Seconds | Returns a second component of a Duration value. |
Duration.ToRecord | Returns a record with parts of a Duration value. |
Duration.TotalDays | Returns the total magnitude of days from a Duration value. |
Duration.TotalHours | Returns the total magnitude of hours from a Duration value. |
Duration.TotalMinutes | Returns the total magnitude of minutes from a Duration value. |
Duration.TotalSeconds | Returns the total magnitude of seconds from a duration value. |
For instance:
Duration.Second([Datetime Column]) //get the second value(0~59) of datetime
Duration.TotalSeconds([Datetime Column]) //convert datetime value to second
Sample: get the diff of date range and convert them to second.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Assuming your [duration colum] has a duration data type, you need to use this syntax to hard code a duration value
if [duration column] > #duration(0,5,0,0) then "yes" else "no"
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.