The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance 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
User | Count |
---|---|
80 | |
74 | |
41 | |
30 | |
28 |
User | Count |
---|---|
108 | |
96 | |
53 | |
48 | |
47 |