Difference between values from separate visuals

I have a sheet with two visuals (tables) displaying numeric values by date. Each table includes a filter for the date field. Now, I’d like to add a third table that shows the difference between the values in the same days of different months. For example, April 1st vs May 1st, April 2nd vs May 2nd, etc

image

The numeric values are coming from the same field (I created two Calculated Field “Total_A” and “Total_B” using field “Total”).

I tried using {Total A}-{Total B} in the third table but it doesn’t seem to work.
Any way I can accomplish this?
Thank you

Hello @Ales !

Have you tried using periodOverPeriodDifference?

Thank you @duncan ,
I understand that in my case, the offset in periodOverPeriodDifference should be dynamic. To calculate it, I created a calculated field using dateDiff:

dateDiff({day A},{day B},"DD")

To check if it works properly, I added it to a new visual but the result is 0

How can I get the offset between the dates correctly?

I’ve made some updates.
{day A} field is now been calculated as per follow:

parseDate(concat(${yearA}, '-', ${monthA}, '-', toString(extract('DD', day))), 'yyyy-MM-dd')

and {day B} is:

parseDate(concat(${yearB}, '-', ${monthB}, '-', toString(extract('DD', day))), 'yyyy-MM-dd')

Calculating the difference in days between the two dates with the following {dateDiff} field:

dateDiff({Day A}, {Day B}, "DD")

It looks like calculations are working correctly:
image

Now trying to use the periodOverPeriodDifference function but getting error “At least one of the arguments in this function does not have correct type. Correct the expression and choose Create again.” when using the following:

periodOverPeriodDifference(sum(total),{Day A}, DAY, {dateDiff})

{dateDiff} part becomes underlined in red and even trying using parseInt function doesn’t solve the problem.