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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Complicated Conditional conditions Column

I have a bit complex goal I want to achieve, not sure if its possible at all.

 

I want to include a custom column that has a number of conditions based on vairus fields. 

 

If ([Date] = (april 26th 2021) and [Time] between (1:30 am and 8:30 Am) and [SLA Met]=0 and [Service Desk]="EUC" then "OK" else "Not OK"

 

Is something like this possible?

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Yes, possible in both Power Query and DAX, but the implementation largely depends on whether your fields are all in the same table or not.

 

Assuming that they are, go to Add Column tab in Power Query, select Custom Column, then enter something like the following formula in the calculation window. I'd recommend doing this in Power Query as DAX calculated columns should only really be used as an absolute last resort due to the memory use they require.

 

 

if [Date] = #date(2021, 26, 04)
  and [Time] >= #time(01, 30, 00)
  and [Time] <= #time(08, 30, 00)
  and [SLA Met] = 0
  and [Service Desk] = "EUC"
then "OK"
else "Not OK"

 

 

If they aren't in the same table, you will either need to merge your tables in Power Query before adding this column, or you will need to create the column in DAX, using RELATED() to reference fields that aren't in the same table (presuming that there is a suitable relationship in place between the tables).

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Yes, possible in both Power Query and DAX, but the implementation largely depends on whether your fields are all in the same table or not.

 

Assuming that they are, go to Add Column tab in Power Query, select Custom Column, then enter something like the following formula in the calculation window. I'd recommend doing this in Power Query as DAX calculated columns should only really be used as an absolute last resort due to the memory use they require.

 

 

if [Date] = #date(2021, 26, 04)
  and [Time] >= #time(01, 30, 00)
  and [Time] <= #time(08, 30, 00)
  and [SLA Met] = 0
  and [Service Desk] = "EUC"
then "OK"
else "Not OK"

 

 

If they aren't in the same table, you will either need to merge your tables in Power Query before adding this column, or you will need to create the column in DAX, using RELATED() to reference fields that aren't in the same table (presuming that there is a suitable relationship in place between the tables).

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Fowmy
Super User
Super User

@Anonymous 
Add the following New Column to your table in the model (NOT power Query): 

Fowmy_0-1622731250263.png

 



New Column =
IF (
    [Date] = DATE ( 2021, 4, 26 )
        && (
            [Time] >= TIME ( 1, 30, 0 )
                && [Time] <= TIME ( 8, 30, 0 )
        )
        && [SLA Met] = 0
        && [Service Desk] = "EUC",
    "OK",
    "Not OK"
)



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Sure mate! You can do it on Power Query: Add Custom Column. There you can apply all the conditions you want. Just be careful to separate the statements with brackets and commas. Also, since you are going to provide specific values, ensure to type the exact value since it is case & string sensitive. 

Helpful resources

Announcements
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.

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.