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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sorathecat
Frequent Visitor

Visualization to show Country only

Hi Everyone, I have a data set currently that has columns of information containing city and country. For example: 

Location.PNG

When i create a visualization it will show as:

Location 2.PNG

 

Is there anyway that i can group everything into countries? Currently there is multiple different bars because of different cities. I want to only show the countries and not the cities, for example USA, AUS, NZ, UK etc. Hopefully there is a easy way for it to detect the same countries and add them all up.

 

Any help will be greatly appreciated! 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @sorathecat ,

 

You can create columns like DAX below.

 

Country =
var FirstComma = FIND(",",'Table1'[Location],1)
var SecondComma = FIND(",",'Table1'[Location],FirstComma + 1)
var LengthOfString = LEN('Table1'[Location])
return
MID('Table1'[Location],SecondComma + 1, LengthOfString - SecondComma + 1)
 
City =
var FirstComma = FIND(",",'Table1'[Location],1)
var SecondComma = FIND(",",'Table1'[Location],FirstComma + 1)
return
LEFT(Table1[Location],SecondComma-1)
 

 

 

75.png

 

 

 

Best Regards,

Amy

 

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-xicai
Community Support
Community Support

Hi @sorathecat ,

 

You can create columns like DAX below.

 

Country =
var FirstComma = FIND(",",'Table1'[Location],1)
var SecondComma = FIND(",",'Table1'[Location],FirstComma + 1)
var LengthOfString = LEN('Table1'[Location])
return
MID('Table1'[Location],SecondComma + 1, LengthOfString - SecondComma + 1)
 
City =
var FirstComma = FIND(",",'Table1'[Location],1)
var SecondComma = FIND(",",'Table1'[Location],FirstComma + 1)
return
LEFT(Table1[Location],SecondComma-1)
 

 

 

75.png

 

 

 

Best Regards,

Amy

 

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

Anonymous
Not applicable

Hi @sorathecat,

 

The Power Query Editor makes this possible! The first thing you're going to want to do is to open the query editor and navigate to the "add column" ribbon. You will click on extract, as shown in the visual below.

ExtractColumn.PNG

 

You will use text after delimiter.  Use the screenshot below to enter in the values.

 

Extract Column2.PNG

Once you click ok, you should end up with two columns like the screenshot below.  Make sure to rename the column! This will allow you to group by country.

 

ExtractColumn3.PNG

 

You can also do this using DAX. If you want to know how to do that, let me know!

 

Hope this helped!

Hi @Anonymous 

 

Thank you!If you can let me know how to do this as a DAX formula will be great because i am building a dashboard on an app and will be manually updating the excel file every few weeks so i want the visualization to update automatically without much modifications as possible in BI! 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.