Trying to have text that counts the number of records in a database in which a specific attribute is "Yes".
What formula do I need to enter into the Expression box, so that if 3 of the 5 records have "Yes" for a specific attribute, then the number displayed is "3"?
Solved! Go to Solution.
Hi Jason,
You can create a View of your layer within Experience Builder and filter to only the ones that say Yes. So, in the expression box you insert Count() and select which view the data is coming from, if it's default or the data view you created:
Create the Data View here:
Select the Data Views when you connect the widget to data
Insert COUNT() and select whitch data view it's counting from:
Let me know if this helps.
Best
Hi Jason,
You can create a View of your layer within Experience Builder and filter to only the ones that say Yes. So, in the expression box you insert Count() and select which view the data is coming from, if it's default or the data view you created:
Create the Data View here:
Select the Data Views when you connect the widget to data
Insert COUNT() and select whitch data view it's counting from:
Let me know if this helps.
Best
Awesome, thanks!!
Is there, by chance, a way to perform a calculation to show the feature count, that has the attribute as "Yes", as a percentage of the total features in the database?
There is. You can add COUNT()/COUNT()*100, and select the data views for each COUNT(). However the result has lots of decimals and I don't know how to change that
Thanks again!!
haha, yea, need to figure out a way to format the text to limit the decimal places!
Is there a way to do any conditional formatting? If the expression resulted in a value 50% or more, could you format the text to be bole red, otherwise it remains the default?
Hi !!
Do you know a way to change the decimals now? Im overthinking with that hahaha
Any help you can provide would be greatly appreciated, I tried this, and it did not work. I am unable to get the count work properly. Any suggestions, I do not need the percentage just the correct number to show for all attributes with a "NO".
Thank you!
Hi Trisha. Did you select the DataView?
The DataView must be selected on the right side panel:
Then you must select the DataView before adding the Statistics "Count":
Let me know if it doesn't work
Yes, I did and that still did not work. It shows a count but not the correct number of the number that is in the data view, data view records are correct not the text number.