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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
160475
Helper I
Helper I

multiple if

dears good day!! 

 

i would like to creat new column that has multiple if statment see pic below 

160475_1-1660734057329.png

 

my statment would be if time commit<9:00 AM then on time 

if time commit between 9:00 am and 9:15 Am then almost late 

if time commit between 9:15 Am and 9:30 AM then late 

if time commit after 9:30 then after working hours 

1 ACCEPTED SOLUTION
MahyarTF
Memorable Member
Memorable Member

Hi,

Use the below code for creating the Column in your table :

StatusCol = If ( time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) < time(09,00,00), "On Time",
              if( time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) >= time(09,00,00)
                  &&
                  time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) < time(09,15,00), "Almost Late",
                  if( time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) >= time(09,15,00)
                      &&
                      time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) < time(09,30,00), "Late",
                      "After Working Houes")
              )
            )
then use it in your visuals.
MahyarTF_0-1660735212644.png

 

Appreciate your Kudos
Mahyartf

View solution in original post

3 REPLIES 3
MahyarTF
Memorable Member
Memorable Member

Hi,

Use the below code for creating the Column in your table :

StatusCol = If ( time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) < time(09,00,00), "On Time",
              if( time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) >= time(09,00,00)
                  &&
                  time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) < time(09,15,00), "Almost Late",
                  if( time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) >= time(09,15,00)
                      &&
                      time(hour(Sheet115[TimeCommit]), minute(Sheet115[TimeCommit]), second(Sheet115[TimeCommit])) < time(09,30,00), "Late",
                      "After Working Houes")
              )
            )
then use it in your visuals.
MahyarTF_0-1660735212644.png

 

Appreciate your Kudos
Mahyartf
Pragati11
Super User
Super User

Hi @160475 ,

 

What is the data type of your Time_commit column?

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

nvprasad
Solution Sage
Solution Sage

Hi 

You can try with below DAX

Remarks = Var TimeCommit = TABLE[TIME_COMMIT]

                RETRUN  SWITCH (TRUE(),

                                           TimeCommit < TIME(9,0,0), "On Time"

                                           TimeCommit  >= TIME(9,0,0) && TimeCommit  < TIME(9,15,0), "almost late",

                                           TimeCommit  >= TIME(9,15,0) && TimeCommit  < TIME(9,30,0), "late",

                      blank())

 

Appreciate a Kudos! ‌‌
If this helps and resolves the issue, please mark it as a Solution! ‌‌

Regards,
N V Durga Prasad

Did I answer your question? Mark my post as a solution! Appreciate your Kudos.
Follow me on LinkedIn.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.