Hey guys,
ss1 is excel file that I have output from a DT I buit (see ss2).
Say if I want to extract the count of just the City “Baltimore”, how do I do it? aka ‘=Countif’ if in excel.
Cheers!
ss1:
ss 2:

Hey guys,
ss1 is excel file that I have output from a DT I buit (see ss2).
Say if I want to extract the count of just the City “Baltimore”, how do I do it? aka ‘=Countif’ if in excel.
Cheers!
ss1:
ss 2:

Hi @Dillon_Marius,
The easiest visual way of doing this is with a Filter Data Table Activity and then counting the number of rows within that filtered DataTable.
This blog post shows 3 additional ways of filtering a DataTable with .NET code, which you can then count the number of rows within that filtered DataTable to obtain the same result.
Thanks
Hi
Use the assign activity to get count, Create Variable as Count = DT_Results.Select(“[city]=‘Baltimore’”).CopyToDataTable.RowCount.ToString
image for reference

Hi Kristopher,
I have a rough idea now thanks.
Noob question, once I have filtered the DT and left with just City of “Baltimore” how do I count?
What i can think of is to loop through for each and add +1 to “n”
Cheers
Hi Soma,
I tried this, but i got an error instead ![]()
What is the Data table name?
Please update the DT_Results with your data table name.
Please paste the error or image here.
Nevermind, I found it.
It’s DT.Rows.count
Thanks again!
Kris I do have just one more question,
Say if I want to “filter” these many names of City, it’s required that I make one “Unique” filter for each right?
Which means that for each of these DT saved as output I’d need to make an additional DT variable for it no
Hi @Dillon_Marius,
Based on the discussion above, yes this would be the easiest way to filter by each City name.
If your dataset increases exponentially and performance becomes an issue, you should revisit the design - but this should work fine for most common use cases.
Thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.