Forum Discussion
Change the calculation to all page based on User Input
- 8 years ago
Hi deepakb18,
On Dax you can use a SWITCH function that is a supersize IF that allow to make several IF, check the link with the explanation.
Regarding your formula using the above syntax you should use the following:
TOTAL Value = SWITCH ( TRUE (); MAX ( Table[Account_Currency] ) = "USD"; SUM ( 'Total Population'[Account Balance Value Reported] ) * MAX ( Rate_USD[Rate_USD Value] ); MAX ( Table[Account_Currency] ) = "EUR"; SUM ( 'Total Population'[Account Balance Value Reported] ) * MAX ( Rate_USD[Rate_EUR Value] ); SUM ( 'Total Population'[Account Balance Value Reported] ) )You should add the as many parameter as table you need the last one is the If nothing of the above happens returns in this case I return the actuals value.
This is the values you should increment in each of your exchange rate (change AAA by your exchange rate):
MAX ( Table[Account_Currency] ) = "AAA"; SUM ( 'Total Population'[Account Balance Value Reported] ) * MAX ( Rate_AAA[Rate_AAA Value] )Regards,
MFelix
Hi deepakb18,
The SWITCH fornula was based on your explanation that you create a 4 parameter table changig the value of the exchange rate and that you wanted several nested IF's so you should add a statment for each of the exchange rate you have.
How are you presenting the values? In a card? in a chart?
You need to had context on the visual you need for example place a slicer or a visual filter where you select the exchange rate to USD, EUR, whatever based on the column Account currency that will give you the expected values.
Regarding the second part of your question do you want to calculate to all rows the value multiplied by the exchange rate? So when you have USD gives amount * 1 when it's GBP gives the amount * exchange rate?
Regards,
MFelix
Let me give you full details
A.
| Currency | Rate |
| USD | 0.7 |
| EUR | 0.8 |
| INR | 0.6 |
All are created as Parameter by using What If Paramaeter
B. Input Data
| BU | Account No | Amount | Currency |
| BU 1 | 101 | 100 | USD |
| BU 1 | 102 | 200 | EUR |
| BU 1 | 103 | 300 | USD |
| BU 1 | 104 | 400 | USD |
| BU 2 | 104 | 500 | EUR |
| BU 2 | 106 | 600 | USD |
| BU 2 | 102 | 300 | USD |
| BU1 | 106 | 300 | EUR |
Step 1 : To calculate Amout After Exchange Rate Conversion
| BU | Account No | Amount | Currency | Final Amount |
| BU 1 | 101 | 100 | USD | 70 |
| BU 1 | 102 | 200 | EUR | 160 |
| BU 1 | 103 | 300 | USD | 210 |
| BU 1 | 104 | 400 | USD | 280 |
| BU 2 | 104 | 500 | EUR | 400 |
| BU 2 | 106 | 600 | USD | 420 |
| BU 2 | 102 | 300 | USD | 210 |
| BU1 | 106 | 300 | EUR | 240 |
Step 2 : Find the Maximum Final Amount from Each Account No
| Account No | MAX Final Amount |
| 101 | 70 |
| 102 | 210 |
| 103 | 210 |
| 104 | 400 |
| 106 | 420 |
Step 3 : Take Distinct BU & Account No from Step 1
| BU | Account No |
| BU 1 | 101 |
| BU 1 | 102 |
| BU 1 | 103 |
| BU 1 | 104 |
| BU 2 | 104 |
| BU 2 | 106 |
| BU 2 | 102 |
| BU1 | 106 |
Step 4: Lookup the Amount from each account no from step 3
| BU | Account No | Final MAX Amount |
| BU 1 | 101 | 70 |
| BU 1 | 102 | 210 |
| BU 1 | 103 | 210 |
| BU 1 | 104 | 400 |
| BU 2 | 104 | 400 |
| BU 2 | 106 | 420 |
| BU 2 | 102 | 210 |
| BU1 | 106 | 420 |
USE Treemap Chart to plot between BU & Final Max Amount