Period over period with dynamic date selection

I am struggling to fix this issue while creating period over period difference when I am selecting month from date filter,

In general I am able to get period over period of current month to previous month as below

Please help me to solve this problem

Can you explain this more? Are you talking about the Last Month Comparison?

The period over period difference will only take into account the previous month. So if you have Nov and not Oct then it will return null.

Hello Max,

I’ve created last month comparison but Now I want when I am selecting two random month as from date filter as below ,

image

Now I am getting visual as below,

So I want comparison with random selected months as well.

Ah. I would instead of doing a period over period look to do a lag function sorted by date.

It would look like this.

(sum(field)-lag(sum(field),[truncDate(‘MM’,timestamp) ASC],1))/(sum(field))

This will then only look at the previous month that is available instead of the previous month on the calendar.

Let me know if that helps

Max,

It is not working with dynamic month selection.

As I highlighted if I select lets say May 2022 and Sept 2022 then I want difference between these selected month

Currently I am getting blank data in difference column after selecting random months,

If I select lets say May and June then I am getting correct data in difference column.

Do you have any idea that we can use parameterized function to solve this issue

Random month selection May and July result as below,

Hmm,

Mine is working. You might need to add a partition to the lag function to partition by Region.

Here is my calculated field.

(count({session_id})-lag(count({session_id}),[truncDate(‘MM’,{arrival_timestamp}) ASC],1,[{client_id[users]}]))/(count({session_id}))

And this is what is showing when I pick Nov & March of 2022.

Hi Max ,

Thanks for your support the solution you provide is working with some modification into it.

Thanks for your quick support.

Could you please share me your linked in link so I can add.

1 Like

Sure thing. Here is my LinkedIn https://www.linkedin.com/in/maxvengelhard/