The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 !
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:
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!