Forum Discussion

tondeli's avatar
tondeli
Advocate I
8 years ago
Solved

Has anyone created datetime table using QueryEditor or DAX?

I have to create calendar table that contains dates with hours and minutes (each date will generate 1440 rows). I have created calendar table using DAX with CALENDAR-function, minDATE and maxDATE bef...
  • MarcelBeug's avatar
    8 years ago

    Query Editor, suppose you have a table with Dates (Query Dates Dec 1-31,2017) and you want the datetime table from the minimum through the maximum date:

     

    Query Dates:

     

    #table(type table[Date = date],List.Zip({List.Dates(#date(2017,12,1),31,#duration(1,0,0,0))}))

     

    Query DateTimes:

     

    #table(
        type table[DateTime = datetime],
            List.Zip(
                {List.DateTimes(
                    List.Min(Dates[Date]) & #time(0,0,0),
                    1440 * (1 + Duration.Days(
                        List.Max(
                            Dates[Date])-
                        List.Min(
                            Dates[Date]))),
                    #duration(0,0,1,0))}))