Forum Discussion
How to subtract hours from DateTime data using DAX?
- 9 years ago
Try this in DAX:
MaxDateFiveHourDiff = MAX(Table1[DateTime]) - 5/24
The DATEDIFF funtion will return an hour.. However, I want to just subtract five hours from my datetime value and display the subtracted date time value.
So, original datetime value: 2016-12-21 09:40 PM. -> (Appy some dax function to subtract the hour by 5) -> New dateimt value: 2016-12-21 04:40 PM.
kaka: 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.
- kaka9 years agoHelper II
Ok, 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 agoResolver II
Try this in DAX:
MaxDateFiveHourDiff = MAX(Table1[DateTime]) - 5/24
- kaka9 years agoHelper II
Fantastic. Thank you.
- Arun18 years agoFrequent Visitor
could you tell name of the function used here?