Forum Discussion
KatyJ44
2 years agoNew Member
calculating days between 2 dates on direct query
Hello everyone, we've recelently been able to connect Maximo into Power Bi through Azure databricks. i'm using this data to track maintenance legal compliance and i want to look at the days between...
Greg_Deckler
Community Champion
2 years agoKatyJ44 Try:
Days until PM Due = ( NOW() - '`hive_metastore` `maxmp76_raw` `workorder`'[TARGCOMPDATE] ) * 1.KatyJ44
2 years agoNew Member
Hi Greg, unfortunalety it didnt work 😞
just out of curiosity what would the *1 at the end of the calculation do?
i'm self taught on PBI so i may have something formatted wrong in the background and DAX and DirectQuery are relatively new to me!
- Greg_Deckler2 years ago
Community Champion
KatyJ44 Let's back up, are you trying to do this in a measure? If so, then you probably need something like this:
Days until PM Due = ( NOW() - MAX('`hive_metastore` `maxmp76_raw` `workorder`'[TARGCOMPDATE]) ) * 1.In DAX, dates are just decimal numbers. The integer portion is the number of days since December 30th, 1899 while the decimal portion is fractions of a day 1/24/60/60. So you can just subtract two dates and multiply by 1 in order to ensure you get back a number instead of a date.