Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Show value from other table

Dear friends

how can i display distinct of "Type" value from table 1 to Table visual that header from table2 (table1 and table2 relations as many-many )

 

Table1

DateTypeSite
01-01-21AANorth
01-01-21ABNorth
02-01-21BASouth
02-01-21AANorth
02-01-21BBSouth

 

Table2

DateTypeSite
01-01-21AANorth
01-01-21ABNorth
02-01-21BASouth
02-01-21AANorth
02-01-21BBSouth
02-01-21BCSouth

 

what i want to display on visual

SiteType (distinct count)
North2
South3

 

but its always show as total distinct value (not seperated by "Site" row header)

SiteType (distinct count)
North5
South5

 

thank in advance for any suggestion.

  • Hi Anonymous ,

     

    You could create new table to union 2 tables, then create a measure to count "Site", the following formula to create :

    (you mentioned that” table1 and table2 relations as many-many “,whether there is a relationship between the two tables will not affect the final result)

    Step1: Create new table:

    newtable = DISTINCT(UNION(SUMMARIZE('Table1',[Site],[Type]),SUMMARIZE('Table2',[Site],[Type])))

    Step2:  New measure

    discount = COUNTX('newtable','newtable'[Site])

    The final output is shown below:

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      which table expression "Site" on countx formular are from?

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

        Anonymous , It should be from _2

        return
        countx(_2, [Site])

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    You could create new table to union 2 tables, then create a measure to count "Site", the following formula to create :

    (you mentioned that” table1 and table2 relations as many-many “,whether there is a relationship between the two tables will not affect the final result)

    Step1: Create new table:

    newtable = DISTINCT(UNION(SUMMARIZE('Table1',[Site],[Type]),SUMMARIZE('Table2',[Site],[Type])))

    Step2:  New measure

    discount = COUNTX('newtable','newtable'[Site])

    The final output is shown below:

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.