Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I've got a calender table with a bunch of DAX foruma's...like date, year, quarter, month, monrht sort, etc.
I'd like to make a new column for "time", specifically hours and minutes. Can anyone help me with a DAX forula so I can have a Time column with hour and minute??
Thanks!
Example, my first DAX in my calender table is
Calendar = CALENDAR(MIN(Invoice[NvDate]),max(Invoice[NvDate]))
Here is a screenshot of the other columns. Would like to have one for time, and if possible hours and minutes in their own column.
Anyone??? Please 🙂
Is this a crazy complicated thing to do or am I the first one to ever ask such a thing???!?!?!
Help :-)!!!
Almost. I tried the formula but get this error...
"The expression refers to multyiple columns. Multiple columns cannot be converted to a scalar value"
Any idea's?
DateTime = ADDCOLUMNS ( CROSSJOIN ( CALENDAR ( DATE ( 2000, 1, 1 ), DATE ( 2025, 12, 31 ) ), UNION ( ROW ( "Time", TIME ( 1, 0, 0 ) ), ROW ( "Time", TIME ( 2, 0, 0 ) ), ROW ( "Time", TIME ( 3, 0, 0 ) ), ROW ( "Time", TIME ( 4, 0, 0 ) ), ROW ( "Time", TIME ( 5, 0, 0 ) ), ROW ( "Time", TIME ( 6, 0, 0 ) ), ROW ( "Time", TIME ( 7, 0, 0 ) ), ROW ( "Time", TIME ( 9, 0, 0 ) ), ROW ( "Time", TIME ( 10, 0, 0 ) ), ROW ( "Time", TIME ( 11, 0, 0 ) ), ROW ( "Time", TIME ( 12, 0, 0 ) ), ROW ( "Time", TIME ( 13, 0, 0 ) ), ROW ( "Time", TIME ( 14, 0, 0 ) ), ROW ( "Time", TIME ( 15, 0, 0 ) ), ROW ( "Time", TIME ( 16, 0, 0 ) ), ROW ( "Time", TIME ( 17, 0, 0 ) ), ROW ( "Time", TIME ( 18, 0, 0 ) ), ROW ( "Time", TIME ( 19, 0, 0 ) ), ROW ( "Time", TIME ( 20, 0, 0 ) ), ROW ( "Time", TIME ( 21, 0, 0 ) ), ROW ( "Time", TIME ( 22, 0, 0 ) ), ROW ( "Time", TIME ( 23, 0, 0 ) ), ROW ( "Time", TIME ( 24, 0, 0 ) ) ) ), "DateTime", [Date] + [Time], "Hour", HOUR ( [Time] ) )
Here is a snip of the error...not sure if looking at the other columns I have might help ID the issue?
Anyone? I'm really trying to get this solved and keep hitting road blocks.
Am I supposed to paste the formula in the advanced editor, not the column/dax formula bar???
I think the problem might be how I do my date...my date is made instead of a preset date range, it goes from the minimum date in the table, to the max date based on invoice number. Like so...
Calendar = CALENDAR(MIN(Invoice[NvDate]),max(Invoice[NvDate]))
then I modded the code suggested to so...
DateTime = ADDCOLUMNS ( CROSSJOIN ( CALENDAR(MIN(Invoice[NvDate]),max(Invoice[NvDate])), UNION ( ROW ( "Time", TIME ( 1, 0, 0 ) ), ROW ( "Time", TIME ( 2, 0, 0 ) ), ROW ( "Time", TIME ( 3, 0, 0 ) ), ROW ( "Time", TIME ( 4, 0, 0 ) ), ROW ( "Time", TIME ( 5, 0, 0 ) ), ROW ( "Time", TIME ( 6, 0, 0 ) ), ROW ( "Time", TIME ( 7, 0, 0 ) ), ROW ( "Time", TIME ( 9, 0, 0 ) ), ROW ( "Time", TIME ( 10, 0, 0 ) ), ROW ( "Time", TIME ( 11, 0, 0 ) ), ROW ( "Time", TIME ( 12, 0, 0 ) ), ROW ( "Time", TIME ( 13, 0, 0 ) ), ROW ( "Time", TIME ( 14, 0, 0 ) ), ROW ( "Time", TIME ( 15, 0, 0 ) ), ROW ( "Time", TIME ( 16, 0, 0 ) ), ROW ( "Time", TIME ( 17, 0, 0 ) ), ROW ( "Time", TIME ( 18, 0, 0 ) ), ROW ( "Time", TIME ( 19, 0, 0 ) ), ROW ( "Time", TIME ( 20, 0, 0 ) ), ROW ( "Time", TIME ( 21, 0, 0 ) ), ROW ( "Time", TIME ( 22, 0, 0 ) ), ROW ( "Time", TIME ( 23, 0, 0 ) ), ROW ( "Time", TIME ( 24, 0, 0 ) ) ) ), "DateTime", [Date] + [Time],)
But i'm still getting an error...now "Function ADDCOLUMNS expects a column name as argument number 4.
Please help 🙂
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
87 | |
84 | |
65 | |
49 |
User | Count |
---|---|
140 | |
114 | |
110 | |
59 | |
59 |