Forum Discussion
KG1
5 years agoResolver I
New Column to create time bands
Hi I need to create a new column which puts a time into a time bracket The time brackets are in hourly slots 00:00-01:00 01:00-02:00 02:00-03:00 03:00-04:00 04:00-05:00 05:...
- 5 years ago
Hi KG1
You can create a column with below code:-
Time_Bracket = VAR start_hour = FORMAT ( Time_Bucket[Time], "hh" ) VAR end_hour = IF ( LEN ( start_hour + 1 ) = 1, "0" & start_hour + 1, start_hour + 1 ) RETURN start_hour & ":00 - " & end_hour & ":00"Thanks
Samarth
- 5 years ago
There were some blank rows at the end of the dataset - I have removed these and it's worked perfectly
Thank you very much for your help
KG1
5 years agoResolver I
There were some blank rows at the end of the dataset - I have removed these and it's worked perfectly
Thank you very much for your help
Samarth_18
5 years agoCommunity Champion
If you want to keep those blanks rows then you can refere below code:-
Time_Bracket =
VAR start_hour =
FORMAT ( Time_Bucket[Time], "hh" )
VAR end_hour =
IF ( LEN ( start_hour + 1 ) = 1, "0" & start_hour + 1, start_hour + 1 )
VAR result = start_hour & ":00 - " & end_hour & ":00"
RETURN
IF ( NOT ( ISBLANK ( Time_Bucket[Time] ) ), result, BLANK () )