Data Range New pre set filter value

Hello guys,

I’m wondering if there is a possibility to add a new pre set data range filter (like this month, this year and so on). I really need to add a new parameter “Next Year”. Maybe it could be also very useful to add Next week, Next month and so on.

What do you think about it? is it a feature that we could develop?

Thanks in advance for any reply and anyone want help me

Another user on the forum added a few. You can use their pull request as a guide:

1 Like

I think the development team’s intention is to make these a lot more customizable so that the presets are configurable not hard-coded.

1 Like

very useful :slight_smile: thank you so much.
I’m gonna try to follow their steps

Hi, we also need this to be customizable. We show 12 months of data but currently showing ‘this year’ cuts off the data. So on Jan 1 all our dat disappears. Any way to resolve this issue so the ‘this year’ function can show data over a 12 month period instead?

Until it’s added to the UI you can follow the example from others and implement it yourself.

It’s very easy to implement…if you need, I can share my code with you. Basically, you can set all the data range you want

Hello, yes please could you show me how you have fixed the issue? thank you so much!

You should modified two files:

The first one is DataRangeParameter.js. For example here, I have added the option, next year. Here you can define the rule according to the moment standard

next_year: {
name: "Next year",
value: () => [
  moment()
    .add(1, "year")
    .startOf("year"),
  moment()
    .add(1, "year")
    .endOf("year"),
],

},

The second one, is DateRangeParameter.jsx
{ name: "Next year", value: getDynamicDateRangeFromString("d_next_year"), label: () => getDynamicDateRangeFromString("d_next_year") .value()[0] .format("YYYY"), },
Where you define the UI part in order to show the new label in data range filter.

However, let me understand better your problem:
This year (2021) 1Jan 2021 - today
Last Year (2020) 1Jan 2020 - 31Dec 2020

last_12_months: {
name: “Last 12 months”,
value: () => [moment().subtract(12, “months”), moment()],
},

It should be correct like it is now

thank you for the fix!