Forum Discussion
Has anyone created datetime table using QueryEditor or DAX?
- 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))}))
Hi Tondeli,
I very much appreciate your effort to understand my solution, and share your approach, rather than just copy/paste something without understanding it.
Otherwise I don't see much added value:
Your Dates query (5 lines) gives exactly the same result as mine (1 line).
Your DynamicDates query gives the same result as the Dates query, except you loose December 31.
And your final query gives the same result as my DateTimes query.
Anyhow if you feel more comfortable with your modifications, then of course you should use your versions (after correction for Decmber 31).
You are correct. I just wanted to share my solution aswell. I just feel more comfortable to use code this way, sorry. Only difference is that I used dynamic dates creating date-table.