Forum Discussion
Dax for New Table
Hello All,
Hope you are all doing good,
I have 2 tables
table one
| region | domain | Values_table1 |
| NA | Sub | 12 |
| NA | Main | 2 |
| NA | Ad | 3 |
| GP | USD | 5 |
| GP | Local | 2 |
Table 2
| region | domain | Values_tables2 |
| NA | Sub | 8 |
| NA | Main | 9 |
| NA | Ad | 4 |
APAC | IND | 6 |
| APAC
| East | 2 |
I have created a custom table with distinct values of the above 2 tables
| region | domain |
| NA | Sub |
| NA | Main |
| NA | Ad |
APAC | IND |
| APAC
| East |
| GP | USD |
| GP | Local |
But when i am using the custom table to show case the values
i am getting summarized duplicate like below
| region | domain | Values_table1 | Values_tables2 |
| NA | Sub | 17 | 21 |
| NA | Main | 17 | 21 |
| NA | Ad | 17 | 21 |
APAC | IND | 8 | |
| APAC
| East | 8 | |
| GP | USD | 7 | |
| GP | Local | 7 |
But this is what i need to show detailed table like below , how can i achieve this
| region | domain | Values_table1 | Values_tables2 |
| NA | Sub | 12 | 8 |
| NA | Main | 2 | 9 |
| NA | Ad | 3 | 4 |
APAC | IND | 6 | |
| APAC
| East | 2 | |
| GP | USD | 5 | |
| GP | Local | 2 |
Hi Anonymous ,
I created this Custom table via two steps.
1 Create a new table.
Custom Table = var _1 = GROUPBY('Table 1','Table 1'[region],'Table 1'[domain]) var _2 = GROUPBY('Table 2','Table 2'[region],'Table 2'[domain]) return DISTINCT(UNION(_1,_2))2 Add two columns via the following code.
Values_table1 = CALCULATE( MAX( 'Table 1'[Values_table1] ), FILTER( 'Table 1', [region] = EARLIER( 'Custom Table'[region] ) && [domain] = EARLIER( 'Custom Table'[domain] ) ) ) Values_table2 = CALCULATE( MAX( 'Table 2'[Values_table2] ), FILTER( 'Table 2', [region] = EARLIER( 'Custom Table'[region] ) && [domain] = EARLIER( 'Custom Table'[domain] ) ) )Result:
I put the pbix file in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandak
Super User
Anonymous , You need to create a concatenated key in table 3 , Table1 and Table2 and join Table3 with 1,2 on that key
And use these two columns from Table 3 in visual
key = [region] &"-" & [domain]
- v-chenwuz-msft
Community Support
Hi Anonymous ,
I created this Custom table via two steps.
1 Create a new table.
Custom Table = var _1 = GROUPBY('Table 1','Table 1'[region],'Table 1'[domain]) var _2 = GROUPBY('Table 2','Table 2'[region],'Table 2'[domain]) return DISTINCT(UNION(_1,_2))2 Add two columns via the following code.
Values_table1 = CALCULATE( MAX( 'Table 1'[Values_table1] ), FILTER( 'Table 1', [region] = EARLIER( 'Custom Table'[region] ) && [domain] = EARLIER( 'Custom Table'[domain] ) ) ) Values_table2 = CALCULATE( MAX( 'Table 2'[Values_table2] ), FILTER( 'Table 2', [region] = EARLIER( 'Custom Table'[region] ) && [domain] = EARLIER( 'Custom Table'[domain] ) ) )Result:
I put the pbix file in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.