Forum Discussion
Power BI Dax - Merging 2 Data Tables With IF Condition
- 2 years ago
Hi,
If I understand well your model you have a 3rd table - I'll call it Table3 - that, as a dimension, has an M:1 relationship with Table1 and Table2, like in the figure:In this case, try something like this:
Spend Or Resubmission =SUMX(VALUES( Table3[Supplier Name] ),VAR _Spend = CALCULATE( SUM( Table1[Spend]) )VAR _SpenResubmission = CALCULATE( SUM( Table2[Spend] ) )RETURNCOALESCE( _SpenResubmission, _Spend ))and you will get this:
We tend to receive data from different sources and they have named the company names slightly different. For example Microsoft can be called Microsoft, Microsoft Inc, Microsoft LTD, Microsoft Limited, etc. So the 3rd table is used to unify these names from the different tables and this is the table we use to show the final data.
When I tried IF(ISBLANK(SUM(ResubmissionSpend)), SUM(Spend), SUM(ResubmissionSpend)) which is the formula we would use in Excel when the data is in 1 table but the sum for total spend didn't sum up correctly.
Any idea why this is please? Thanks.
- Xavianna2 years ago
Helper I
AntrikshSharma Will the DAX you provided previously work across 3 tables please? If not, what could I do to make it work please? Thanks.