Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Connecting 3+ tables

I have 3 tables (projects, tool A, tool B) which are connected with project number, and need to get : 

 

1. total projects

2. projects using tool A

3. projects using tool B

4. projects using tool A and B

5. projects not using A nor B tool

 

is there an easy way how to do this ?

only way i could think of is to create new table and bring there column projects from projects table (150k rows) and then add column related for A, new column related for B and do Venn diagram ? 

 

or vlookups ? 

 

thank you for help

  • parry2k's avatar
    parry2k
    7 years ago

    Anonymous try following and tweak it from there :

     

    Add two column in your main project table to define which project exists in which table

     

    Project Exists in PS = 
    VAR x = RELATED( PS[ProjectID] )
    RETURN IF( x = BLANK(), 0, 1 )
    
    Project Exists in PW = 
    VAR x = RELATED(PW[ProjectID] )
    RETURN IF( x = BLANK(), 0, 1 )

     

     

     

    and then add a table using following DAX, it will put all projects together alongwith whcih category they are in

     

    Total Projects = 
    UNION(
    ADDCOLUMNS( Project, "Category", "Doesn't exists" ),
    ADDCOLUMNS( CALCULATETABLE( Project, FILTER( Project, Project[Project Exists in PS] = 1 && Project[Project Exists in PW] = 1 ) ), "Category", "Exists in Both" ),
    ADDCOLUMNS( CALCULATETABLE( Project, FILTER( Project, Project[Project Exists in PW] = 1 ) ), "Category", "Exists in PW" ),
    ADDCOLUMNS( CALCULATETABLE( Project, FILTER( Project, Project[Project Exists in PS] = 1 ) ), "Category", "Exists in PS" ) 
    )

     

    drop pie chart visual, use category from this new project table "Total Project" and use "count of project id" as value. I think this will get your what you are looking for.

     

     

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Main table is Project .. 2 tools tables Projectsite and PW connected to Projects table .. 

     

    Can I have a Pie chart showing total projects using ProjectSite, Pw, Projectsite and PW and none of those 2 ? 

     

    I managed to connect them with " Style " table . but still not able to get the result i want 

     

     

     

    • parry2k's avatar
      parry2k
      Icon for Super User rankSuper User

      Anonymous

       

      Still not fully clear about your requirements.

       

      Are you try to have pie chart based on 

       

      - name from PW and show total distinct projects

      - name from PS and show total distinct projects

       

      Is this correct?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        trying to get something like this