How ca I see basic stats in Trello?
Asked by Greg Wallace:

I'm just wanting to see how many new cards are being added to a board in a particular timeframe. We use a board for tacking leads and I'm keen t know how many are added each week as a metric to tracking marketing progress.

I've tried a few power ups but with no success.

Any ideas?


Answers:
author: milynnus
body: [@Greg Wallace](/t5/user/viewprofilepage/user-id/4085732) the ability to count can be achieved in many ways especially if you can use Trello API like using the fetch_actions function. By setting the filter to look for createCard and since (datetime object)...and also keeping track of last processing date ...etc etc

```
def fetch_actions(self, action_filter, action_limit=50, before=None, since=None):
```

Alternatively, with some creative use of labels and resetting thereafter, you can create simple report variables every Sunday 2am and feed this via a HTTP Request to an endpoint that can count for you or send it somewhere.

Here's an example of how this is being used to update a CF on the card but a simple count would be just len(\[list of {cardidlong}\]) and returning it via a httprespose.thisweekcount <https://youtu.be/gr5_tWnO-Xw> learn more [here](https://community.atlassian.com/t5/Trello-discussions/A-Powerful-Combination/td-p/1479754)

Or keeping them on a particular list and just count and keep it, use Trello report to send data to you via email....etc etc.

My question **how would you want to keep this piece of data.** Will it be part of a bigger but simple dashboard like [https://youtu.be/YiuyeeSyhgg](https://youtu.be/YiuyeeSyhgg "this MVP") or simply record it somewhere?

comments: author: milynnus
body: Here's a short video of one solution using the report variable.

<https://youtu.be/X2lbENPf0ow>

Here, I am using card with yellow labels to denote cards created this week. It can be other mechanisms so long you can get a report variable around them and able to reset them after the run...which may be a new challenge. Nothing prevents you from adding to the module to remove the labels or the reset needed.

```
every day at 5:45 pm, create a report in variable "repo_var" with all cards with the yellow label using pattern "{cardidlong}", post to url "https://25368.wayscript.io/butler/?registry=5f216a81........&module=5f608738b........5704" with payload "{\"report_variable\" : \"{$repo_var}\"}", and create a new card with title "New Card Count for {date} is {httpresponse.count}" in list "Next Step"
```


author: milynnus
body: [@Greg Wallace](/t5/user/viewprofilepage/user-id/4085732) The http request can also be a call to the fetch_actions. Here is a working code but not added to my Butler Add-on

```
from datetime import datetime
para = {
"board_id": "5f196.......4266c6de", # use module to get idModel using Board as the scope and a board name
"isodate" : "06-09-2020", 
"time24" : "12:34" 
}
sp_variables = ""

date_str = "{} {}:00".format(para['isodate'], para['time24'])

format = "%d-%m-%Y %H:%M:%S"

datetime_obj = datetime.strptime(date_str,format)

board = client.get_board(para['board_id'])
actions = board.fetch_actions(action_filter='createCard', action_limit=50, before=None, since=datetime_obj)

sp_variables = json.dumps({"count" : str(len(actions)) })
```

Above can be used to count anything by making the filter as input from Butler. This is probably overly simplistic assumption on what constitute a new marketing activity for you since no other criteria were applied.

Frankly, I would not be too surprised should someone come up with a ingenious solution.