So, basically, our app allows users to parse information, and it saves each parsed item in the DB as a “parse”.
In our dashboard, we show those parses in a graph, month by month, and that works perfectly.
Now, the part where we got stuck is in trying to also display, in the dashlet that contains the graph but OUTSIDE the graph, the percentage change in parses created from the last month to the current one.
Meaning, if someone created 10 parses in July, and 20 in August, it should show 100%, or 50% viceversa.
I’m trying with groupings and the such, but I’m super stuck and can’t find the way to do it!
It only needs to happen from last month to the current month.
You will not use group by in this case. You should find this and last month’s in the constraints of the Search for Parses and the final expression will look like: (Search for Parses:count - Search for Parses:count) / Search for Parses:count
The first Search for Parses will have creation date to be between Current Date/time and Current Date/time:rounded down to month (to find this month’s Parses).
The second Search for Parses will have creation date to be between Current Date/time:rounded down to month and Current Date/time:rounded down to month +months: -1 (to find previous month’s Parses).
Also recognize the paranthesis in the expression. You should do the subtraction first. And for this, you should enable paranthesis expressions in the settings tab.
You will add two constraints with Creation Date in it. One will be the lower limit and one will be the upper limit. Check the example below for this month’s:
While at it, since you already know the config for this element, is there a way to conditionally change the font color based on whether the number is positive or negative? I’m thinking no, right?
You can simply do the same calculation and put a condition to change the default color to something else.
A condition would be Search for Parses (first one above):count - Search for Parses (second one above):count > 0 → Change color.
Another improvement would be, if you don’t want to calculate this over and over again, maybe set This month's parses to a custom state on page load (and for the other too).