cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper I

## Count comma in same cell

Hi guys,

I have one collumn with location

My collumn:

 LOCATION PORTUGAL SPAIN SPAIN PORTUGAL SPAIN SPAIN SPAIN PORTUGAL SPAIN ITALY ITALY FRANCE FRANCE

My measure to calculate the number of countries

MEASURELOCATION= calculate(counta('Table1'[Coluna1]),Filter(Table1,Table1[LOCATION]="SPAIN"))

The result is: 6
If i have the country and city in same cell it's possible to count?

tABLE LIKE:
 LOCATION PORTUGAL,LISBON SPAIN,MADRID SPAIN,BARCELONA PORTUGAL,LISBON SPAIN,SEVILHA SPAIN,MADRID SPAIN,BARCELONA PORTUGAL,LISBON SPAIN,BARCELONA ITALY,ROMA ITALY,ROMA FRANCE,PARIS FRANCE,PARIS

It's possible to count example: quantity of MADRID ?

Best regards,

1 ACCEPTED SOLUTION
Solution Sage

Hi @a10703,

The simplest way of doing it is to simply add the location column to the table and change the aggregation to "Count". This will give you a count of each city.

However, if your requirement is to specifically create measures, you can create one like below :

COUNTROWS(
FILTER(
Locations,
)
)

You can modify this measure as per your requirement. Currently it is specific for Madrid but you can have a single measure to compute counts of each location as well.

Kind regards,

Rohit

3 REPLIES 3
Community Support

Hi @a10703 ,

``````MEASURELOCATION =
CALCULATE (
COUNTROWS ( Table1 ),
FILTER ( Table1, SEARCH ( "MADRID", Table1[LOCATION], 1, BLANK () ) > 0 )
)``````

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helper I

Hey @v-kkf-msft ,

I need to count only by line not to all example

In this case i need measure for madrid and other for spain because in the same cell i can have more than 1: example: SPAIN,MADRID,BARCELONA,MADRID

Best regards and thanks for help

Solution Sage

Hi @a10703,

The simplest way of doing it is to simply add the location column to the table and change the aggregation to "Count". This will give you a count of each city.

However, if your requirement is to specifically create measures, you can create one like below :

COUNTROWS(
FILTER(
Locations,
)
)

You can modify this measure as per your requirement. Currently it is specific for Madrid but you can have a single measure to compute counts of each location as well.

Kind regards,

Rohit

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors