Forum Discussion
How to sum two thing
Hello expoerts,
I want from example belllow to tell me the dax code that calculate:
- the amount orginated from Chaina and imported from Chaina and called the direct & amount that orginated from Chain but imported from countries other than Chaina and called undirect counties.
Them tell me what the best chart should to use to show the amount for amount direct country and undirect countries.
Hello:
Please find report for you. I hope you mark as solution.
https://drive.google.com/file/d/1P8HqbFn_JnOfwBK8k2LxwmafGbMdhfTk/view?usp=sharing
- Anonymous4 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Use Enter data to create a table.
2. Create measure.
direct country = CALCULATE(SUM('Table'[Amount ]),FILTER(ALL('Table'),'Table'[Country of Origin ]="China"&&'Table'[Country of Import ]="China"))undirect countries = CALCULATE(SUM('Table'[Amount ]),FILTER(ALL('Table'),'Table'[Country of Origin ]="China"&&'Table'[Country of Import ]<>"China"))Measure = SWITCH( TRUE(), MAX('Table2'[Group])="direct country",[direct country], MAX('Table2'[Group])="undirect countries",[undirect countries])3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
7 Replies
- AnonymousNot applicable
Hi Anonymous ,
Here are the steps you can follow:
1. Use Enter data to create a table.
2. Create measure.
direct country = CALCULATE(SUM('Table'[Amount ]),FILTER(ALL('Table'),'Table'[Country of Origin ]="China"&&'Table'[Country of Import ]="China"))undirect countries = CALCULATE(SUM('Table'[Amount ]),FILTER(ALL('Table'),'Table'[Country of Origin ]="China"&&'Table'[Country of Import ]<>"China"))Measure = SWITCH( TRUE(), MAX('Table2'[Group])="direct country",[direct country], MAX('Table2'[Group])="undirect countries",[undirect countries])3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- daXtreme
Solution Sage
An example of such calculations please.
- AnonymousNot applicable
Country of Origin Country of Import Amount China China 34 China UAE 3445 China UAE 5676 China China 6768 China UAE 342 China KSA 132 China UAE 323 Turkey UAE 234 China Russia 4545 China India 76 @dtxtreme
- Whitewater100
Solution Sage
Hello:
Please find report for you. I hope you mark as solution.
https://drive.google.com/file/d/1P8HqbFn_JnOfwBK8k2LxwmafGbMdhfTk/view?usp=sharing
- AnonymousNot applicable
Whitewater100
Hello again,
I gave you before an example for specific country which is China.
How I can do that a dynamaic, for example, when I use slicer for any country in country of Origin, it give direct and undirect values for country of Import
- AnonymousNot applicable
try this
Imp & Org China = calculate(sum(Data[Amount ]),Data[Country of Origin ]="China"&&Data[Country of Import ]="China")Origin China-Import Not China = calculate(sum(Data[Amount ]),Data[Country of Origin ]="China"&&Data[Country of Import ]<>"China") - Whitewater100
Solution Sage
Hi:
These are the calculated columns I sent earlier with the visual examples:
Direct(org & Imp China) = IF(AND(Data[Country of Origin ] = "China", Data[Country of Import ] = "China"), Data[Amount ])Origin China-Import Not China = IF(AND(Data[Country of Origin ] = "China", Data[Country of Import ] <> "China"), Data[Amount ])