Count Duplicates values using subtotal function

Copper Contributor

Hi everyone,

I need help to count different values on a column based on a filter (dinamic).

Ex: I have a Year (Ano) column. On the picture below this column has 3 differents values.

bsantos96_0-1614001301724.png

But when I filter any other column, this amount can change.

Ex: Now i have just 2 differents values.

bsantos96_1-1614001538659.png

Does anyone knows how to calculate this? I try to use the subtotal function, but didn't work. 

I appreciate any help.

Thanks guys.

 

2 Replies

@bsantos96 

You need helper column which returns 0 for hided rows, otherwise 1

image.png

Formula for the Helper is

=AGGREGATE(3,5,[@Ano])

With it counting on filtered table returns

image.png

Hi @Sergei Baklan. Thanks for the help!

 

I think didn't explain very well. Sorry. 

I'm trying to Sum the column "V.Total" but because there's 3 years for example, the values of "V.Total" is adding up 3 times. So I'm trying to count how many different values there's in column "Ano" to calculate the sum of column "V.Total".

Ex: There's 3 differents values on column "Ano" to the same row. So I'll add another column Total = V.Total/3. When I sum the column Total, the result will be correct.

bsantos96_1-1614004958060.png

If you think another way to solve this I also accept.

 

Thanks!