Forum Discussion

newpbiuser01's avatar
newpbiuser01
Helper V
3 years ago
Solved

Merging Queries vs Lookup

Hello,   I have a question about merging tables vs. using the lookup function in dax. I am currently working on a report with three tables and we have a somewhat circular relationship between them ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi newpbiuser01 

    You can use dax to solve it.

    You can refer to the following examples.

    Table A:

    Vendor Active = IF(COUNTROWS(FILTER('Table C',[Vendor]=EARLIER('Table A'[Vendor])&&[Status]="Active"))>0,"Yes","No")
    
    Location = var a=FILTER('Table B',[Vendor]=EARLIER('Table A'[Vendor]))
     return CONCATENATEX(a,[Location],",")

     

    Table B:

    In Scope = IF(COUNTROWS(FILTER('Table C',[Vendor]=EARLIER('Table B'[Name])&&[Status]="Active"))>0,"Yes","No")
    
    Vendor Manager = var a=SUMMARIZE(FILTER('Table C',[Vendor]=EARLIER('Table B'[Name])),[Manager])
    return CONCATENATEX(a,[Manager],",")
    
    Active Programs = var a=FILTER('Table A','Table A'[Vendor]=EARLIER('Table B'[Name])&&[Status]="Running")
    return MAXX(FILTER(a,[Date]=MAXX(a,[Date])),[Program])

    Table C

    Ongoing Programs = CONCATENATEX(FILTER('Table A',[Vendor]=EARLIER('Table C'[Vendor])&&[Status]="Running"),[Program],",")
    
    Location = var a=FILTER('Table B',[Vendor]=EARLIER('Table C'[Vendor]))
     return CONCATENATEX(a,[Location],",")
    
    Vendor Number = MAXX(FILTER('Table B',[Name]=EARLIER('Table C'[Vendor])),[Number])

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.