March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello World!
I have a column called Time.
I want to create a column called Day of Time based on the given Time Range.
Solved! Go to Solution.
@Samiks95 Please try:-
Day of Time =
SWITCH (
TRUE (),
'Table_'[Time] >= TIME ( 05, 00, 00 )
&& 'Table_'[Time] <= TIME ( 09, 59, 00 ), "Early Morning",
'Table_'[Time] >= TIME ( 10, 00, 00 )
&& 'Table_'[Time] <= TIME ( 11, 59, 00 ), "Late Morning",
'Table_'[Time] >= TIME ( 12, 00, 00 )
&& 'Table_'[Time] <= TIME ( 15, 59, 00 ), "Early Afternoon",
'Table_'[Time] >= TIME ( 16, 00, 00 )
&& 'Table_'[Time] <= TIME ( 17, 59, 00 ), "Late Afternoon",
'Table_'[Time] >= TIME ( 18, 00, 00 )
&& 'Table_'[Time] <= TIME ( 20, 59, 00 ), "Evening",
'Table_'[Time] >= TIME ( 21, 00, 00 )
&& 'Table_'[Time] <= TIME ( 23, 59, 00 ) || 'Table_'[Time] >= TIME ( 00, 00, 00 )
&& 'Table_'[Time] <= TIME ( 04, 59, 00 ), "Night"
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Samiks95 Seems I dont have access to it. Can you please share the file with open access?
or you can easily use https://wetransfer.com/
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @Samiks95 ,
You could try to create a column as below:-
Day of Time =
SWITCH (
TRUE (),
'Table'[Time] >= TIME ( 05, 00, 00 )
&& 'Table'[Time] <= TIME ( 09, 59, 00 ), "Early Morning",
'Table'[Time] >= TIME ( 10, 00, 00 )
&& 'Table'[Time] <= TIME ( 11, 59, 00 ), "Late Morning",
'Table'[Time] >= TIME ( 12, 00, 00 )
&& 'Table'[Time] <= TIME ( 15, 59, 00 ), "Early Afternoon",
'Table'[Time] >= TIME ( 16, 00, 00 )
&& 'Table'[Time] <= TIME ( 17, 59, 00 ), "Late Afternoon",
'Table'[Time] >= TIME ( 18, 00, 00 )
&& 'Table'[Time] <= TIME ( 20, 59, 00 ), "Evening",
'Table'[Time] >= TIME ( 21, 00, 00 )
&& 'Table'[Time] <= TIME ( 04, 59, 00 ), "Night"
)
Output:-
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Samiks95 ,Please try this:-
Day of Time =
SWITCH (
TRUE (),
'Table_'[Time] >= TIME ( 05, 00, 00 )
&& 'Table_'[Time] <= TIME ( 09, 59, 00 ), "Early Morning",
'Table_'[Time] >= TIME ( 10, 00, 00 )
&& 'Table_'[Time] <= TIME ( 11, 59, 00 ), "Late Morning",
'Table_'[Time] >= TIME ( 12, 00, 00 )
&& 'Table_'[Time] <= TIME ( 15, 59, 00 ), "Early Afternoon",
'Table_'[Time] >= TIME ( 16, 00, 00 )
&& 'Table_'[Time] <= TIME ( 17, 59, 00 ), "Late Afternoon",
'Table_'[Time] >= TIME ( 18, 00, 00 )
&& 'Table_'[Time] <= TIME ( 20, 59, 00 ), "Evening",
'Table_'[Time] >= TIME ( 21, 00, 00 )
&& 'Table_'[Time] <= TIME ( 11, 59, 00 ) || 'Table_'[Time] >= TIME ( 00, 00, 00 )
&& 'Table_'[Time] <= TIME ( 04, 59, 00 ), "Night"
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Samiks95 Please try:-
Day of Time =
SWITCH (
TRUE (),
'Table_'[Time] >= TIME ( 05, 00, 00 )
&& 'Table_'[Time] <= TIME ( 09, 59, 00 ), "Early Morning",
'Table_'[Time] >= TIME ( 10, 00, 00 )
&& 'Table_'[Time] <= TIME ( 11, 59, 00 ), "Late Morning",
'Table_'[Time] >= TIME ( 12, 00, 00 )
&& 'Table_'[Time] <= TIME ( 15, 59, 00 ), "Early Afternoon",
'Table_'[Time] >= TIME ( 16, 00, 00 )
&& 'Table_'[Time] <= TIME ( 17, 59, 00 ), "Late Afternoon",
'Table_'[Time] >= TIME ( 18, 00, 00 )
&& 'Table_'[Time] <= TIME ( 20, 59, 00 ), "Evening",
'Table_'[Time] >= TIME ( 21, 00, 00 )
&& 'Table_'[Time] <= TIME ( 23, 59, 00 ) || 'Table_'[Time] >= TIME ( 00, 00, 00 )
&& 'Table_'[Time] <= TIME ( 04, 59, 00 ), "Night"
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
You can upload it in google drive share a link or you can use https://wetransfer.com/
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@Samiks95 Seems I dont have access to it. Can you please share the file with open access?
or you can easily use https://wetransfer.com/
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Sir, you're a genius. It worked. Thank you so much
I'd start with creating a new table (lets call it TimeDefs) in this format:
Day Of Time | Start | End |
Early Morning | 05:00:00 | 10:00:00 |
Late Moring | 10:00:00 | 12:00:00 |
Early Afternoon | 12:00:00 | 16:00:00 |
The new column would be then:
DoT =
VAR _row_time = Table[Time] //this is the column which you want to categorize
RETURN
MAXX (
FILTER (
'TimeDefs',
'TimeDefs'[Start] >= _row_time
&& 'TimeDefs'[End] < _row_time
),
[Day of Time]
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
22 | |
19 | |
16 | |
9 | |
5 |
User | Count |
---|---|
37 | |
29 | |
16 | |
14 | |
12 |