- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Help Please with an IF Statement with Time Values to create Interval Groups
Hi all,
My apologies in advance as I haven't ever asked a question using this community before but wanted to say "thank you" to the community because this support group has helped me out several times before 🙂
I have been working on a way to create a new column in Power BI for a little over a week now and I can't seem to grasp what I need to do. This is a side project that I am trying to help a coworker with so I haven't been able to put too much time into it but have reached the point where I am out of ideas.
My goal is to take a column that has previously been converted from a 'Date/Time" field into just a Time column. Now, I need to take that time column and create a new column that looks at the time and then based on the conditions below, returns the time slots back to me. It is easier to show below:
Column Name with just Time in it: Helper
Time Slot Conditions:
If [Helper] >= 07:30 to 10:30, "Breakfast"
If [Helper] >= 12:00 to 15:30, "Lunch"
If [Helper] >= 16:30 to 18:30, "Snacks"
If [Helper] >= 19:30 to 23:00, "Dinner"
If [Helper] >= 12:00 to 04:00, "Midnight"
Else "Other Snacks"
I will admit that I have tried all kinds of formulas but none of them seem to work and give error messages. Can anyone please help because I am at a loss.
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This seems like a good case to use a SWITCH statement in a calculated column.
Something like this should get you pointed in the right direction. (I used [Time] as the column with times in it where you had [Helper].)
Proud to be a Super User! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@blfox33 Time values are fractions of a day, like 1/24/60 would be in minutes so maybe something like:
Time Slot Conditions Column:
VAR __Minutes = 1/24/60
VAR __MinutesInHour = 60 * __Minutes
VAR __Helper = [Helper]
VAR __Resut =
SWITCH( TRUE(),
[Helper] >= __MinutesInHour * 7.5 && <= __MinutesInHour * 10.5, "Breakfast",
[Helper] >= __MinutesInHour * 16.5 && <= __MinutesInHour * 18.5, "Snacks",
[Helper] >= __MinutesInHour * 19.5 && <= __MinutesInHour * 23, "Dinner",
[Helper] >= __MinutesInHour * 0 && <= __MinutesInHour * 4, "Midnight",
"Other Snacks"
)
RETURN
__Result
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This seems like a good case to use a SWITCH statement in a calculated column.
Something like this should get you pointed in the right direction. (I used [Time] as the column with times in it where you had [Helper].)
Proud to be a Super User! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello! Oh my goodness, it is working now!!! Thank you so much!

Helpful resources
Join our Fabric User Panel
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Power BI Monthly Update - June 2025
Check out the June 2025 Power BI update to learn about new features.

User | Count |
---|---|
65 | |
60 | |
51 | |
36 | |
36 |
User | Count |
---|---|
81 | |
72 | |
58 | |
45 | |
44 |