Knowledge Base Article

Show the Data for This and Last Year, But Not the Current Month Dynamically

Show the Data for This and Last Year, But Not the Current Month Dynamically

Task: We want to show data for this and last year, but not the current month dynamically.

For example, we have this data:


We want to show it, but not for the current month, as the information for it is still in process.

So, we create a Line Chart widget 


With Months in Date in X-Axis and Total revenue in Values.

Now we will create a custom filter based on Months in Date.

 
The code of the filter is

 

{
  "or": [
    {
      "next": {
        "count": 24,
        "offset": 1
      }
    },
    {
      "last": {
        "count": 24,
        "offset": 1
      }
    }
  ],
  "multiSelection": true
}

 


In this filter, we have two parts which connected to OR

Select the next 12 months, but not the current

 

    {
      "next": {
        "count": 12,
        "offset": 1
      }
    }

 


Select last 12 months, but not current

 

    {
      "last": {
        "count": 12,
        "offset": 1
      }
    }

 


If necessary, you can use just the part of the filter that you need.

And as the final result we will get the next data without the current month (it is May 2024)

Published 05-22-2024
No CommentsBe the first to comment