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.
I have a CreationDate column and i want to create another column where i can add/subtract hours using a parameter. For eg
CreationDate = 21 Jan 2022, 2 PM and Parameter = 2, the value would be 21 Jan 2022, 2 PM + 2 = 21 Jan 2022, $ PM
Similarly if Parameter = -3, the new column would be 21 Jan 2022, 2 PM - 3 = 21 Jan 2022, 11 AM
Solved! Go to Solution.
Hi @shivamsharma1 ,
Since the new date is dynamically changed by parameter, you need to create Measure instead of Calculated Column. (Column is static that could not be changed )
Please firstly add a What-if parameter
And then create measure:
New Date Measure = MAX('Table'[CreationDate ]) +(1/24) *[Parameter Value]
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @shivamsharma1 ,
Since the new date is dynamically changed by parameter, you need to create Measure instead of Calculated Column. (Column is static that could not be changed )
Please firstly add a What-if parameter
And then create measure:
New Date Measure = MAX('Table'[CreationDate ]) +(1/24) *[Parameter Value]
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @watkinnc,
thanks for replying but I wanted to use this computation in dax rather thatn using in M query. Because my columns have dates from 3 different columns
If your parameter is named AddHours, your custom column formula would be:
= Table.AddColumn(PriorStepOrTableName, "Adjusted", each [Created Date] + #duration(0, AddHours, 0, 0))
--Nate
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.