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

Join 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.

Reply
Anonymous
Not applicable

How to count text occurrence of values in a column incrementally and concatenate in a new column

Hi Team,

 

I'm new to PowerBI and experimenting with PowerBI to gain some useful insights into the data that we have.

 

So far with the Map visualization, I have been able to gain good insights, but it isn't quite helpful when presenting the data.

 

So what I currently have is a column consisting of the country name where the sale was performed, now what I want to do is it displays the country name and the number of times a sale has been done in that country, now I can see it with tooltip without any issue but isn't something that I can take a screenshot and put it into powerpoint.

 

What I would like to achieve is to display the number of times the country value appears, so was thinking if there is a way that I can create a new column to count the number of times the value appears in the country column incrementally and then concatenate the country and count and display on the map visualization.

 

Any help or insights that you would be able to provide is greatly appreciated.

 

Regards,

Arun

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

Yes, it is possible. I create sample table. You can create a calculated column using the formula as follows.

CountryName-Number =
CONCATENATE (
    Countries[CountryName] & "-",
    COUNTX (
        FILTER ( Countries, [CountryName] = EARLIER ( Countries[CountryName] ) ),
        [CountryName]
    )
)

1.PNG

Or add space between Country name and count.

CountryName Number = 
CONCATENATE (
    Countries[CountryName] & " ",
    COUNTX (
        FILTER ( Countries, [CountryName] = EARLIER ( Countries[CountryName] ) ),
        [CountryName]
    )
)

2.PNG

Best Regards,
Angelia

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

It could theoretically be done, just create a column like:

 

Country&Number = CONCATENATE([Country],COUNTX(FILTER('Countries',[Country]=EARLIER([Country])),[Country]))

But my bet is that is going to screw up Bing maps from geocoding it properly.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi smoupre,

 

Thank you for the below, is it possible to add a "-" in between the concatenation or Space as currently what I'm getting is a CountryName1234.

 

Once I get the above in order I will try to see if I can get the Bing Maps to be going okay.

 

The Map visualization requires an added functionality of call outs.

 

Regards,

Arun

Hi @Anonymous,

Yes, it is possible. I create sample table. You can create a calculated column using the formula as follows.

CountryName-Number =
CONCATENATE (
    Countries[CountryName] & "-",
    COUNTX (
        FILTER ( Countries, [CountryName] = EARLIER ( Countries[CountryName] ) ),
        [CountryName]
    )
)

1.PNG

Or add space between Country name and count.

CountryName Number = 
CONCATENATE (
    Countries[CountryName] & " ",
    COUNTX (
        FILTER ( Countries, [CountryName] = EARLIER ( Countries[CountryName] ) ),
        [CountryName]
    )
)

2.PNG

Best Regards,
Angelia

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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