Select to view content in your preferred language

Count records where two fields have distinct values

323
2
08-27-2024 10:55 AM
SanchezNuñez
Frequent Contributor

Good afternoon,

I am looking for a way to  count in a layer how many records have two fields distinct, and show  the result in a text box. 

Thanks

 

 

0 Kudos
2 Replies
SanchezNuñez
Frequent Contributor

This is what I need if I use a SQL Statement:

SELECT distinct
[ProjectNumber]
,[ProjectPage]
FROM ProjecTables



And the count will be


SELECT COUNT(*)
FROM (
SELECT distinct
[ProjectNumber]
,[ProjectPage]
FROM ProjecTables
) as dt

 

Please advise

0 Kudos
ShengdiZhang
Esri Regular Contributor

Hi @SanchezNuñez ,

The text widget supports Arcade expressions in the June 2025 AGOL release.

You can use a script like this in your expression:

var ds = $dataSources["dataSource_id"].layer;
var distinctItem = Distinct(ds, 'CNTRY_NAME');

return Count(distinctItem);

Regards,

Shengdi

0 Kudos