Forum Discussion
Power bi Calculated table
There are two table i.e
table1
| area | number |
| 1 | 909 |
| 2 | 908 |
| 3 | 907 |
| 6 | 897 |
| 4 | 876 |
| 5 | 878 |
and table2
| area | number |
| 9 | 441 |
| 10 | 232 |
| 5 | 3423 |
| 2 | 233 |
| 11 | 1213 |
| 12 | 234 |
required calculated table is
| area | number |
| 1 | 909 |
| 2 | 233 |
| 3 | 907 |
| 6 | 897 |
| 4 | 876 |
| 5 | 3423 |
| 9 | 441 |
| 10 | 232 |
| 11 | 1213 |
| 12 | 234 |
update the old data(table1) with the new data(table2) on power bi desktop
Thank & regrads
Biswajit
Found a solution :-
Z_TABLE =
VAR _old =
FILTER (
'table1',
'table1'[AC_NO - Copy]
<>CALCULATE (
SELECTEDVALUE('table2'[AC_NO - Copy]),
ALLEXCEPT (
'table1','table1'[AC_NO - Copy]
)
)
)
VAR _new = 'table2'
RETURN
UNION(_old,_new)
7 Replies
- mrcss23Advocate IV
Hi.
You should go to power query / transform
Then select APPEND QUERIES
and choose this way in picture
- BIswajit_DasImpactful Individual
But appending both tables cause duplicates entries of both tables
- mh2587Super User
Just Append both the tables in Power Query it will resolve your problem
- BIswajit_DasImpactful Individual
Thank you for responding but
isn't appending both table combines all the records old+new
- mrcss23Advocate IV
After the suggested step, the table 1 will have added all the record of table 2.
You you then use table 1 because it will have the full records.
- BIswajit_DasImpactful Individual
I just need to take the recent records based on area not all the
- BIswajit_DasImpactful Individual
Found a solution :-
Z_TABLE =
VAR _old =
FILTER (
'table1',
'table1'[AC_NO - Copy]
<>CALCULATE (
SELECTEDVALUE('table2'[AC_NO - Copy]),
ALLEXCEPT (
'table1','table1'[AC_NO - Copy]
)
)
)
VAR _new = 'table2'
RETURN
UNION(_old,_new)