0
$\begingroup$

I have a product database with a created and a deleted field in datetime format.

I want to aggregate this data into a bar graph with count(created)/year, count(deleted)/year and saldo/year.

I have already accomplished this for one year with calculated fields:

Created_2020:

IF DATEPART('year',[created]) = 2020 THEN
1
ELSE
0
END

Deleted_2020:

IF DATEPART('year',[deleted]) = 2020 THEN
-1
ELSE
0
END

Saldo_2020:

IF [Created_2020] + [Deleted_2020] != 0 THEN
[Created_2020] + [Deleted_2020]
END

How can I do this for multiple years?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.