Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi team
How can i create a TimeKey column from a Time column in powerquery.
The timekey column will be in seconds from 1-86400.
This is similar to creating a datakey eg: 2019-06-13 to 20190613.
The idea behind creating a timekey is to join this fact table key to a timekey in a time dimension table in my dw which would allow for the data to be sliced by different time fields.
i would prefer to do this in Power Query.
Solved! Go to Solution.
Hi,
Enter the Query Editor, click on your query, go to tab "Add Column" -> "Custom Column", enter column name and formula like code below, adjust the code by adding ",Int64.Type". Don't forget to click the "Close & Apply" button.
Time.Hour([Time])*60*60+Time.Minute([Time])*60+Time.Second([Time])
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Enter the Query Editor, click on your query, go to tab "Add Column" -> "Custom Column", enter column name and formula like code below, adjust the code by adding ", type time". Don't forget to click the "Close & Apply" button.
=#time(0,0,0) + #duration(0,0,0,[TimeKey])
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xicai , Unfortuantely thats not what i am after as i already have a time column!
I am trying to convert time from hh:mm:ss to seconds (wholenumber). This would then form a key to be joined to a time dimension table.
Hi,
Enter the Query Editor, click on your query, go to tab "Add Column" -> "Custom Column", enter column name and formula like code below, adjust the code by adding ",Int64.Type". Don't forget to click the "Close & Apply" button.
Time.Hour([Time])*60*60+Time.Minute([Time])*60+Time.Second([Time])
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |