Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
notalex
Frequent Visitor

why is my DateTime column in my DateTime table not showing minutes

Hi everyone,
I have made a DateTime table. I am struggeling to get the DateTime column in my table to display the minute of the day.
How would i edit the code below to get it to also display minutes.
All help is appreciated.


DateTimeTable =
ADDCOLUMNS(
    CROSSJOIN(
        CALENDAR(DATE(2021,1,1), DATE(2025,12,31)),
        GENERATESERIES(0, 23, 1)
    ),
    "DateTime", [Date] + TIME([Value], 0, 0),
    "DateAsInteger", FORMAT([Date], "YYYYMMDD"),
    "Year", YEAR([Date]),
    "QuarterOfYear", "Q" & FORMAT([Date], "Q"),
    "MonthOfYear", FORMAT([Date], "MMMM"),
    "MonthNumber", MONTH([Date]),
    "DayOfMonth", DAY([Date]),
    "DayOfWeek", FORMAT([Date], "dddd"),
    "WeekNumber", WEEKNUM([Date])
)


Thank you in advance

1 REPLY 1
Adamboer
Responsive Resident
Responsive Resident

To add the minute of the day to the DateTime column, you can modify the "DateTime" column definition in the ADDCOLUMNS function as follows:

"DateTime", [Date] + TIME([Value], ROUND(MOD([Value],1)*60,0), 0)

This will add the minute component to the TIME function, which calculates the time of day based on the hour from the "Value" column and the minute from rounding the decimal part of the "Value" column multiplied by 60.

So the final DateTimeTable function will be:

DateTimeTable =
ADDCOLUMNS(
CROSSJOIN(
CALENDAR(DATE(2021,1,1), DATE(2025,12,31)),
GENERATESERIES(0, 23, 1)
),
"DateTime", [Date] + TIME([Value], ROUND(MOD([Value],1)*60,0), 0),
"DateAsInteger", FORMAT([Date], "YYYYMMDD"),
"Year", YEAR([Date]),
"QuarterOfYear", "Q" & FORMAT([Date], "Q"),
"MonthOfYear", FORMAT([Date], "MMMM"),
"MonthNumber", MONTH([Date]),
"DayOfMonth", DAY([Date]),
"DayOfWeek", FORMAT([Date], "dddd"),
"WeekNumber", WEEKNUM([Date])
)


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.