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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MarcLykke
Frequent Visitor

Creating a new column with multiple IF-statements from different tables

Hi everyone

 

I am trying to create a new column in table 1 in which it should say "Yes" if several conditions from the 3 separate tables are met.

 

All three tables are related by the ID-variable. It is possible for the same ID to appear in several rows in both table 2 and 3.

The new column should say "Yes" if the status from table 1 = "Active", AND if the colour = "Red" OR "Blue" in table 2, AND if the End date > Today() in table 3.

I have tried several different solutions without any luck. Can anyone help me with this one?

 

Table 1:

IDStatusNew column
ID 2349Active 
ID 1234Active 
ID 9876Not active 

 

Table 2:

IDColourBrand
ID 2349Red Brand 1
ID 1234Blue Brand 2
ID 9876Green Brand 3

 

Table 3: 

IDStart DateEnd date
ID 234910/11/2021 22/12/2021
ID 123405/06/202120/10/2021
ID 987607/10/202110/05/2022
1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @MarcLykke 

Here's some DAX for your new column

New column = 
IF(
    Table1[Status] <> "Active", "No",
    VAR _RedOrBlue = CALCULATE(COUNTROWS(Table2), Table2[Colour] IN {"Red", "Blue"})
    VAR _EndAfterToday = CALCULATE(COUNTROWS(Table3), Table3[End date] > TODAY())
    VAR _Result = IF(_RedOrBlue >= 1 && _EndAfterToday >= 1, "Yes", "No")
    RETURN
        _Result
)

Assuming your model looks something like this

PaulOlding_0-1637686026044.png

 

View solution in original post

2 REPLIES 2
PaulOlding
Solution Sage
Solution Sage

Hi @MarcLykke 

Here's some DAX for your new column

New column = 
IF(
    Table1[Status] <> "Active", "No",
    VAR _RedOrBlue = CALCULATE(COUNTROWS(Table2), Table2[Colour] IN {"Red", "Blue"})
    VAR _EndAfterToday = CALCULATE(COUNTROWS(Table3), Table3[End date] > TODAY())
    VAR _Result = IF(_RedOrBlue >= 1 && _EndAfterToday >= 1, "Yes", "No")
    RETURN
        _Result
)

Assuming your model looks something like this

PaulOlding_0-1637686026044.png

 

Perfect!
Thank you very much 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.