Question: I have a list of people ID who has attended training from 2014 to 2018. I need to get details of number of people who has not attended training in 2017 and attended in 2018.

[![img](https://i.stack.imgur.com/QqVvN.png)](https://i.stack.imgur.com/QqVvN.png)

i filtered the year ("Start date") to 2017 and 2018. and used no of records to check how many people attended.

Now how do i get number of records from this list that who has attended training in 2018 and not in 2017?

i tried this in the calculation. but it shows Null value. 

```
SUM(IF ISNULL(YEAR([Start Date])=2017) AND 
NOT ISNULL(YEAR([Start Date]) =2018) 
THEN
1
END)

```

[![img2](https://i.stack.imgur.com/MqUa1.png)](https://i.stack.imgur.com/MqUa1.png)

Any help please?

Answer: 
A solution would consist in abstracting the logic to run inference using a session in module. In this module, the session, and the graph would be defined once as global variable, and would be transparently accessed by your views, or whatever, using interfaces like a function `run_inference`. 

If you need more fine control over the lifecycle of the graph and/or session you could consider adding functions like `reload_graph` etc... or implement that within your module, for example using a class dedicated to managing the lifecycle of the tensorflow objects, and running inference. 

This looks to me like the best solution. This way you will also be able to have a more robust workflow, and have more control in case for example you want to use multithreading and want more safety with respect to how the inference code is run.
As I commented to the previous solution suggestion, graph/session stopped being the optimal solution a long time ago.
I recommend you to start using mlops, and leave everything preloaded as much as you can, so that when you call the api, django only takes care of generating the predict.
I leave you here my project, I have several with ML/Django/Tflite

If you have any doubt don't hesitate to ask me.

Link to my project: <https://github.com/Nouvellie/django-mlops-docker/blob/main/src/main/apps/mlops/utils/model_loader.py>