Count Button doesn't return aggregation

Hello data family,

I am trying to do a simple aggregation using a button in my app on a column in my Excel data source. I am simply trying to get the button to return " 7 " Containers when I click it. The formula I used via the OnSelect Property is CountRows(Table.Containers) . Please help!
image
image

Thanks

Hi @mobeidat,

You haven’t described where you want that count to show… but try this.

in the OnSelect for your button:
UpdateContext({calcVal: !calcVal})

Add a label/ or set the button Text to:
If( calcVal; "Show count"; CountIf(Containers; true) )

Note you will need to replace Containers with your DataSource or Collection

I hope this is helpful

Hi @Melissa

Thank you so much for taking the time to respond on this.

Your first Formula didn’t error out but the second one did, it gave this

Any idea of what I’m doing wrong? Also, I just want the " 7 " to show when you click the button as the users add more containers but at the moment it should just show " 7 "

Thanks

Hi @mobeidat,

Oh I see your separator is a comma, you need to change the “;” by “,”
Afterwards you can toggle the value, by pressin the button

Hi @Melissa

Thank you very much. That solved it.
image

Regards,