How to use "periodOverPeriodDifference" with today's date?

Hi guys,

How to use “periodOverPeriodDifference” with today’s date?
The now() isn’t work.

I need the calculated field to bring the variation (difference) between the current month and the previous month, without the user having to select the months in the filter

Thanks

periodOverPeriodDifference(
{my_field_calculated},
now(),
MONTH,
1
)

Hello @July

I was thinking if we substitute now() with a calculated field like:

parseDate((formatDate(now(), ‘dd-MM-yyyy’)),‘dd/MM/yyyy’)

And then use it

periodOverPeriodDifference({calculated-field1},{current-date},MONTH,1)

Can you try and let us know if this gives expected results?

Also, I think you have to include {current-date} in your visual as it may throw calculation_reference_missing exception. (you can choose to hide it after including in the visual)

Hello @msnehali

I substituted the now() with parsedate as you showed me, I put the calculated-field in visual, but it shows ‘no data’ (KPI visual)

Any ideia?

Tks!

Hi @July
I checked into it and could find a way to represent it in KPI referring Dylan’s calculation, you check this below link:

I used the below Calculation:

Lag function to get PeriodOverPeriodDifference (test-popd):

lag({calculated-field},[Timestamp ASC], 1) - {calculated-field}

Using Lag, I could get the previous month value returned, and then I subtracted it from current month value. You can refer to my test below and represent it in KPI using the similar KPI options

Hope this helps! Thanks.

2 Likes