Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Add filter button for specific time range

Hello,

 

koray_0-1638965971145.png

 

I want to add filter button to my report. Like this:

 

Between 07:05 - 15:20  Shift 1

Between 15:20 - 23-25 Shift 2

Between 23:35 - 07:05 Shift 3

 

Can you please help me?

Regards

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Test the below dax to create a new column:

Vardiya = 
VAR hour =
    HOUR ( Sayfa1[Tartim_Bitis] )
VAR MINUTE =
    MINUTE ( Sayfa1[Tartim_Bitis] )
VAR test =
    FORMAT ( Sayfa1[Tartim_Bitis], "hh:mm:ss" )
RETURN
    IF (
        test >= "07:05:00"
            && test < "15:20:00",
        "Shift1",
        IF ( test >= "15:20:00" && test < "23:25:00", "Shift2", "Shift3" )
    )

vluwangmsft_0-1639379909643.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

 

 

View solution in original post

6 REPLIES 6
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Test the below dax to create a new column:

Vardiya = 
VAR hour =
    HOUR ( Sayfa1[Tartim_Bitis] )
VAR MINUTE =
    MINUTE ( Sayfa1[Tartim_Bitis] )
VAR test =
    FORMAT ( Sayfa1[Tartim_Bitis], "hh:mm:ss" )
RETURN
    IF (
        test >= "07:05:00"
            && test < "15:20:00",
        "Shift1",
        IF ( test >= "15:20:00" && test < "23:25:00", "Shift2", "Shift3" )
    )

vluwangmsft_0-1639379909643.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

 

 

Anonymous
Not applicable

Hello @v-luwang-msft 

 

Thank your for help 😘

Anonymous
Not applicable

Who can help me?

amitchandak
Super User
Super User

@Anonymous , You can create a column  for that

first have time column or var in a column

 

Time = [datetime].Time
or
Time = Time(hour([datetime]),minute([datetime]),second([datetime]))

 

New bucket =

var _1  = Time(hour([datetime]),minute([datetime]),second([datetime]))

return

Switch( True(),

_1>= time(7,5,0)  && _1<= (15,20,0) , "Shift 1",

_1> (15,20,0)  && _1<= (23,25,0) , "Shift 2",

"Shift 3"

)

 

You can use that filter

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello   @amitchandak

This formul worked but it doesn't calculate minutes. How can i fix this.

 

Vardiya =
VAR hour =
HOUR ( Z110_Lignes_pesee[Tartim_Bitis] )
RETURN
"Shift "& IF ( hour >= 7.30 && hour < 15.20, "Shift 1", IF ( hour >= 15.20 && hour < 23.35, "Shift 2", "Shift 3" ) )
 

 

Anonymous
Not applicable

Thank you for reply @amitchandak 

 

But I didn't understand how to do it. Can you help me with the attached file?

 

https://easyupload.io/txugdw

 

Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Users online (6,699)