Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
27 |
User | Count |
---|---|
92 | |
50 | |
44 | |
40 | |
35 |