Forum Discussion
mike_asplin
Helper V
5 months agoMAX datetime truncates to date???
Wasnt expecting this. I have single cell table for the refesh time which is dd/mm/yyyy 00:00:00 format to use it on a card I converted it to a measure but it comes out just dd/mm/yyyy???...
- 5 months ago
Hi mike_asplin,
When you use MAX('Refresh Time'[Refresh Time])
Power BI returns a DateTime value internally, but:
- The Card visual auto-formats it
- And often defaults to showing only the date part
To avoid this
Select your column 'Refresh Time'[Refresh Time], change format to dd MMM yyyy HH:mm:ss
now you can use it in MAX and you should get the correct results.
If not then Use Format
If the issue is fixed, Mark it as accepted solution
InsightsByV
Super User
5 months agoHi,
I use below in Blank Query for adding Last Refresh date:
let
IST_TimeZone = DateTimeZone.SwitchZone(DateTimeZone.UtcNow(), 5.5),
IST_Time = DateTimeZone.RemoveZone(IST_TimeZone),
IST_Text = DateTime.ToText(IST_Time, "dd-MMM-yyyy hh:mm tt", "en-IN"),
#"Converted to Table" = #table(1, {{IST_Text}}),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "LastRefresh"}})
in
#"Renamed Columns"
You can tweak around to show your desired format and timezone. But this is a saviour - if it helps!
mike_asplin
Helper V
5 months agoThats the column isnt an issue its turning it inot a measure to put it on card, but thanks anyway