Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kannan4444
Helper I
Helper I

BUY and SELL based on country

I have my dataset in below format. i want to see the BUY and SELL for China in one chart. can you please help?

Example: Jan month - China has export 200 and imports 300

Kannan4444_0-1659102537446.png

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Kannan4444 ,

 

Please try:

First create a table for slicer and turn the single select on:

For slicer = DISTINCT( UNION( SUMMARIZE('Table',[Load Country]),SUMMARIZE('Table',[Discharge Country])))

vjianbolimsft_0-1659686021074.png

Output:

vjianbolimsft_1-1659686043265.png

Then create the following measures:

Export = CALCULATE(SUM('Table'[Voulme]),FILTER('Table',[Load Country]=SELECTEDVALUE('For slicer'[Country])))

Imports = CALCULATE(SUM('Table'[Voulme]),FILTER('Table',[Discharge Country]=SELECTEDVALUE('For slicer'[Country])))

Apply them to the visual:

vjianbolimsft_2-1659686128623.png

vjianbolimsft_4-1659686152148.png

Final output:

vjianbolimsft_5-1659686175890.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Kannan4444 ,

 

Please try:

First create a table for slicer and turn the single select on:

For slicer = DISTINCT( UNION( SUMMARIZE('Table',[Load Country]),SUMMARIZE('Table',[Discharge Country])))

vjianbolimsft_0-1659686021074.png

Output:

vjianbolimsft_1-1659686043265.png

Then create the following measures:

Export = CALCULATE(SUM('Table'[Voulme]),FILTER('Table',[Load Country]=SELECTEDVALUE('For slicer'[Country])))

Imports = CALCULATE(SUM('Table'[Voulme]),FILTER('Table',[Discharge Country]=SELECTEDVALUE('For slicer'[Country])))

Apply them to the visual:

vjianbolimsft_2-1659686128623.png

vjianbolimsft_4-1659686152148.png

Final output:

vjianbolimsft_5-1659686175890.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

gauthamboppana
Solution Specialist
Solution Specialist

@Kannan4444  -  Refer to this sample pbix file. Let me know if you have any questions.

1. In Power Query, transpose your data as below.

gauthamboppana_1-1659116155295.png


2. Create two measure as below

Exports = CALCULATE(sum('Table'[Volume]),'Table'[Country Type] = "Load Country")
Imports = CALCULATE(sum('Table'[Volume]),'Table'[Country Type] = "Discharge Country")

3. Now use these measure in the visuals.
gauthamboppana_2-1659116215326.png

 

Did I answer your question? Mark my post as a solution! If not, please feel free to ask me.

Also, I would ❤ Kudos if my solution helped.  It is a token of appreciation!

Thank you very much !

can you please share the Pbix file please

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors