Forum Discussion
IF formula with multiple conditions
I have 2 tables and 1 country table which is used to create relationship between them (even other tables linked to country table).
Now i need to check if Amt is available in Table1 for the same country in Table2, if available then i need to take sum of Table2[Amt]/table1[Amt] else 0.
i have single direction relationship between Table2 & country and bothside direction relationship between Table1 & Country.
in excel i can use cell reference to do this (ex:=IF(F8=0, 0,AJ8/F8)) but am unble to do this in power bi. please assist
Table1:
| Region | Amt |
| Greater China | 100 |
| SEA-K | 140 |
| India | 345 |
| Japan | 235 |
| South Pacific | 34 |
Table2:
| Region | Amt |
| Greater China | 57 |
| SEA-K | 34 |
| India | 23 |
| Japan | 57 |
| South Pacific | 23 |
| India | 34 |
| Japan | 42 |
Country: table
| Country |
| Region |
| Greater China |
| SEA-K |
| India |
| Japan |
| South Pacific |
Output table expeted:
| Region | Amt | Divide Amt |
| Greater China | 57 | 0.57 |
| SEA-K | 34 | 0.242857143 |
| India | 57 | 0.165217391 |
| Japan | 99 | 0.421276596 |
| South Pacific | 23 | 0.676470588 |
Anonymous Please try this as a New Table (below logic uses your table 1 as lookup and table 2 as base table)
Test297Out = VAR _Table = SUMMARIZE(Test297Main,[Region],"Amt",SUM(Test297Main[Amt])) RETURN ADDCOLUMNS(_Table,"DivideAmount",DIVIDE([Amt],LOOKUPVALUE(Test297Lkp[Amt],Test297Lkp[Region],Test297Main[Region])))
1 Reply
- PattemManoharCommunity Champion
Anonymous Please try this as a New Table (below logic uses your table 1 as lookup and table 2 as base table)
Test297Out = VAR _Table = SUMMARIZE(Test297Main,[Region],"Amt",SUM(Test297Main[Amt])) RETURN ADDCOLUMNS(_Table,"DivideAmount",DIVIDE([Amt],LOOKUPVALUE(Test297Lkp[Amt],Test297Lkp[Region],Test297Main[Region])))