Forum Discussion

Excellove15's avatar
Excellove15
Iron Contributor
Feb 17, 2025
Solved

Creating Logic to find whether columns in one table matches other columns in other table

Hi Team,   I have 2 tables: Door table as below: Store Status table as below:   They are modelled as below (let me know if we can better model it-suggestions are welcomed):   Now,...
  • SergeiBaklan's avatar
    Feb 25, 2025

    Excellove15 ,  the problem is we have no relationship between Door and Store. Calculating StatusDoor and StatusStore and combing it with IF we have some kind of CrossJoin. IF() returns 0 for each store not in filtered door. We need to return BLANK() instead, measure will be

    _Breach = VAR Statuses =
        MAX ( Door[Status] ) & [_Status]
    VAR Breach =
        IF ( ISBLANK ( [_Status] ), BLANK (), IF ( Statuses = "OpenC", 1, 0 ) )
    RETURN
        IF ( HASONEVALUE ( Door[SiteId] ), Breach, BLANK () )

    To calculate total just iterate it on all doors

    Breach Total = SUMX ( Door, [_Breach] )

    Finally

    File is B&M (4).pbix

Resources