Try this calculated column formula
Format this column as Date/Time.
Hope this helps.
Do this in Power Query. Your model will perform better, and it is a simple formula.
Add a new Custom Column in Power Query and add this formula, then round as desired.
= Duration.TotalHours([Col1] - [Col2])
This calculated column formula works
Hope this helps.
Thanks for the replay but I have done some calculation for getting (calculated column) date/time for the table. so i need dax to achieve this in front side.
To create column in query editor is difficult for me.
is there any way to achieve in dax?
@Ashish_Mathur did it in DAX, which will work better for you since your dates were created in DAX. Consider using Power query in the future for all columns though. It is just good practice. The problem is calculated columns are very "excel-like" and Excel users jump on them, but that is not a good long term practice, especially for large models.
In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Visit our Community Blog for articles, guides, and information created by fellow community members.
Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.
Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.