Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
Solved! Go to Solution.
Hello:
Please find report for you. I hope you mark as solution.
https://drive.google.com/file/d/1P8HqbFn_JnOfwBK8k2LxwmafGbMdhfTk/view?usp=sharing
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
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
Hi:
These are the calculated columns I sent earlier with the visual examples:
try this
Hello:
Please find report for you. I hope you mark as solution.
https://drive.google.com/file/d/1P8HqbFn_JnOfwBK8k2LxwmafGbMdhfTk/view?usp=sharing
@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
An example of such calculations please.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
19 | |
17 | |
12 | |
9 | |
9 |