Forum Discussion
kaka
Helper II
9 years agoHow to subtract hours from DateTime data using DAX?
I am creating a new column using DAX where I need to display a date by subtracting five hours from it. So, if my date is 2016-12-21 09:40 pm, it should be 2016-12-21 04:40 pm. The function...
- 9 years ago
Try this in DAX:
MaxDateFiveHourDiff = MAX(Table1[DateTime]) - 5/24
danrmcallister
Resolver II
9 years agokaka: What parry2k meant by saying it's M rather than DAX is that the function mentioned in the linked article was applied in the Query Editor - see below.
kaka
Helper II
9 years agoOk, so that would be an unnecessary column for me because what am actually doing in DAX is grabbing the maximum date from the table and then subtracting it's hour by 5. So, am creating a column called MaxDateFiveHourDiff:
MaxDateFiveHourDiff = MAX(due_date) - 5 hours. Question is, how do you subtract the 5 in DAX ?
- danrmcallister9 years ago
Resolver II
Try this in DAX:
MaxDateFiveHourDiff = MAX(Table1[DateTime]) - 5/24