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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
User_266
Frequent Visitor

Count of two columns

Hello,

 

I have a Dataset with several columns, two of which look like this:

 

| Departure Country |     | Arrival Country |
| France |                         | Belgium |
| France |                         | Italy |
| Switzerland |                 | France |
| France |                         | Italy |
| France |                         | China |
| France |                         | Switzerland |
| Germany |                     | France |

 

I want to be able to count the number of appearances of each country in one of the two columns. Here for example I will have:

 

| Country |  | Total |

| France   |   | 7 |

 

To do this I therefore need a column which combines the two departure and arrival columns into one, to be able to insert it into a table visualization with the number of appearances for each country.

 

Do you have an idea please?


Thanks !

2 REPLIES 2
Anonymous
Not applicable

Hi  @User_266 ,

 

 

Here are the steps you can follow:

1. Create calculated column.

Column =
var _countdc=
COUNTX(
    FILTER(ALL('Table'),
    'Table'[Departure Country]=EARLIER('Table'[Departure Country])),[Departure Country])
var _countac=
COUNTX(
    FILTER(ALL('Table'),'Table'[Arrival Country]=EARLIER([Departure Country])),[Arrival Country])
return
_countdc + _countac

2. Result:

vyangliumsft_0-1710206520965.png

 

Best Regards,

Liu Yang

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

Hello,

Thank you for your reply!

I'd rather have an index column that allows me to group all the country names, and then display next to them the number of times each one appears in departure + arrival. In my example this would be :

| Country "Index" |  | Total |

| France   |               | 7 |

| Switzerland  |        | 2 |

| Italy  |                    | 2 |

| Belgium |               | 1 |

| China |                   | 1 |

| Germany |              | 1 |

 

Thank you for your time!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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