Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi everyone
In the Query Editor I have a column with Timestamps and in another column I have a number.
See the picture below.
That number is the hour offset I want to plus into the timestamp.
The result should look like this:
I can create a new column where I do the calculation with this command = [Timestamp] + #duration (0, [Hours Offset], 0.0)
But is it possible to do the calculation in the original column?
Thanks in advance
Solved! Go to Solution.
Hi @M-M-P
Credit to @ImkeF for this method using Table.ReplaceValue (post here)
Rather than adding a new column, put this in the formula bar (where PreviousStep is the name of your previous query step):
= Table.ReplaceValue(PreviousStep, each [Timestamp], each [Timestamp]+#duration(0,[Hours Offset],0,0), Replacer.ReplaceValue, {"Timestamp"})
This has the side-effect of discarding the column type of Timestamp.
To avoid losing the column type, you can use this code instead:
= Value.ReplaceType(Table.ReplaceValue(PreviousStep, each [Timestamp], each [Timestamp]+#duration(0,[Hours Offset],0,0), Replacer.ReplaceValue, {"Timestamp"}), Value.Type(PreviousStep))
Regards,
Owen
Hi @M-M-P
Credit to @ImkeF for this method using Table.ReplaceValue (post here)
Rather than adding a new column, put this in the formula bar (where PreviousStep is the name of your previous query step):
= Table.ReplaceValue(PreviousStep, each [Timestamp], each [Timestamp]+#duration(0,[Hours Offset],0,0), Replacer.ReplaceValue, {"Timestamp"})
This has the side-effect of discarding the column type of Timestamp.
To avoid losing the column type, you can use this code instead:
= Value.ReplaceType(Table.ReplaceValue(PreviousStep, each [Timestamp], each [Timestamp]+#duration(0,[Hours Offset],0,0), Replacer.ReplaceValue, {"Timestamp"}), Value.Type(PreviousStep))
Regards,
Owen
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |