COUNT The Unique Values In A Column

Input collection: myCities24

CityContinentCountry
New YorkNorth AmericaUSA
LondonEuropeUnited Kingdom
KyotoAsiaJapan
OsakaAsiaJapan
Los AngelesNorth AmericaUSA
ParisEuropeFrance
BirminghamEuropeUnited Kingdom


Output value: mySolution24a (unique Country names)

4


Solution code:

//Create a collection
ClearCollect(myCities24,
{City: "New York", Country: "USA", Continent: "North America"},
{City: "London", Country:"United Kingdom", Continent: "Europe"},
{City: "Kyoto", Country: "Japan", Continent: "Asia"},
{City: "Osaka", Country: "Japan", Continent: "Asia"},
{City: "Los Angeles", Country: "USA", Continent: "North America"},
{City: "Paris", Country: "France", Continent: "Europe"},
{City: "Birmingham", Country:"United Kingdom", Continent: "Europe"}
);

//Count unique values in column code
Set(mySolution24a,CountRows(Distinct(myCities24,Country)));


Output value: mySolution2b (unique Continent names)

3


Solution code:

//Create a collection
ClearCollect(myCities24,
{City: "New York", Country: "USA", Continent: "North America"},
{City: "London", Country:"United Kingdom", Continent: "Europe"},
{City: "Kyoto", Country: "Japan", Continent: "Asia"},
{City: "Osaka", Country: "Japan", Continent: "Asia"},
{City: "Los Angeles", Country: "USA", Continent: "North America"},
{City: "Paris", Country: "France", Continent: "Europe"},
{City: "Birmingham", Country:"United Kingdom", Continent: "Europe"}
);

//Count unique values in column code
Set(mySolution24b,CountRows(Distinct(myCities24,Continent)));