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
JackWren
Helper I
Helper I

Count based on two different columns

Hi everyone, 

 

First time poster here. I have a table with three different columns

Column 1 is Customer-ID

Column 2 is Country

Column 3 is Region 

 

I'm trying to count the number of clients for each country's region. 

For example, the result should be that there are 3 customers for Bxl in Belgium, two for Chubu in Japan etc. 

I was thinking about concatenating the two region and country columns into a single column but I think creating a measure might be smarter. I just don't know how to built it to take two different columns into account. 

 

Do you have any idea how to proceed? 

 

Thanks

 

Cust_ID      Pays         Region

1FranceIDF
2BelgiumWL
3BelgiumBXL
4BelgiumBXL
5BelgiumBXL
6BelgiumFL
7BelgiumFL
8BelgiumFL
9FranceIDF
10FranceIDF
11FranceOccitanie
12FranceOccitanie
13JapanHokkaido
14JapanHokkaido
15JapanHokkaido
16JapanChubu
17JapanChubu
1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

Hello @JackWren and welcome to the community,

 

Quick and Easy solution is to create a table add Country, Region and for Cust_ID (select count) 

See image below

Quick.png

 

If you want to create a measure, then add the following formula

No_of_Customers = COUNT('Table'[Cust_ID ])
or
No_of_Customers = DISTINCTCOUNT('Table'[Cust_ID ])

 

View solution in original post

2 REPLIES 2
JackWren
Helper I
Helper I

Hi @themistoklis,

 

Thank you for your recommandations! I'm going to try the first option.

 

themistoklis
Community Champion
Community Champion

Hello @JackWren and welcome to the community,

 

Quick and Easy solution is to create a table add Country, Region and for Cust_ID (select count) 

See image below

Quick.png

 

If you want to create a measure, then add the following formula

No_of_Customers = COUNT('Table'[Cust_ID ])
or
No_of_Customers = DISTINCTCOUNT('Table'[Cust_ID ])

 

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.