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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
thomasgcoelho
Frequent Visitor

Simple "FILTER" and "IF" on multiple matching rows

Hello! I'm trying to create a new column that checks if certain information has a match in another table, but I'm failing because my reference column matches more than once.

 

I have an "Inspections Table", like this:

MonthInspection LeaderInspected Location
SeptemberAlbertFront yard
SeptemberBernardBack yard
OctoberCromwellFront yard
OctoberBernardBack yard
DecemberCromwellWest yard

 

And a "Planning Table", like this:

MonthPlanned LocationPlanned Leader
SeptemberFront yardAlbert
SeptemberBack yardCromwell
OctoberWest yardCromwell
OctoberFront yardBernard
DecemberWest yardDennis
DecemberBack yardBernard

 

I'm trying to create two columns at the end of the "Inspections Table" like these:

MonthInspection LeaderInspected LocationSame Leader as planned for the month?Same Location as planned for the month?
SeptemberAlbertFront yardYesYes
SeptemberBernardBack yardNoYes
OctoberCromwellFront yardYesYes
OctoberBernardBack yardYesNo
DecemberCromwellWest yardNoNo

 

I tried going for a FILTER with an IF in DAX, but I can't get it right. I think I'm having trouble with the fact that months may occur more than once in the "Planning Table".

 

Thanks in advance!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@thomasgcoelho 

I can get everything to match up except the December - West Yard I must be missing something.  It is in both your inspections and planning table, just with a different leader so I get a Yes for [Same Location as planned for the month?].  Anyway, here are the calculated columns using LOOKUPVALUE.

Same Leader as planned for the month? = 
IF (
    Inspections[Inspection Leader]
        = LOOKUPVALUE (
            Planning[Planned Leader],
            Planning[Month], Inspections[Month],
            Planning[Planned Leader], Inspections[Inspection Leader]
        ),
    "Yes",
    "No"
)
Same Location as planned for the month? = 
IF (
    Inspections[Inspected Location]
        = LOOKUPVALUE (
            Planning[Planned Location],
            Planning[Month], Inspections[Month],
            Planning[Planned Location],Inspections[Inspected Location]
        ),
    "Yes",
    "No"
)

jdbuchanan71_0-1630889546123.png

 

View solution in original post

2 REPLIES 2
thomasgcoelho
Frequent Visitor

Thank you @jdbuchanan71 ! Now I see where I messed up. Marked your reply as solution.

jdbuchanan71
Super User
Super User

@thomasgcoelho 

I can get everything to match up except the December - West Yard I must be missing something.  It is in both your inspections and planning table, just with a different leader so I get a Yes for [Same Location as planned for the month?].  Anyway, here are the calculated columns using LOOKUPVALUE.

Same Leader as planned for the month? = 
IF (
    Inspections[Inspection Leader]
        = LOOKUPVALUE (
            Planning[Planned Leader],
            Planning[Month], Inspections[Month],
            Planning[Planned Leader], Inspections[Inspection Leader]
        ),
    "Yes",
    "No"
)
Same Location as planned for the month? = 
IF (
    Inspections[Inspected Location]
        = LOOKUPVALUE (
            Planning[Planned Location],
            Planning[Month], Inspections[Month],
            Planning[Planned Location],Inspections[Inspected Location]
        ),
    "Yes",
    "No"
)

jdbuchanan71_0-1630889546123.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.