I have a ‘Create_Date’ and ‘Month’ fields in my dataset.
My requirement is to filter the last 45 days based on the month selected from the Month filter.
Let’s say, If I pick ‘Jan-2024’ from the month filter. I need to pick the results from ‘Jan-31-2024’ to last 45 days based on the ‘Create_Date’ field.
Thank you!
Hi Praveen, what data type is your Month field? Based on your description it appears to be a string instead of a Date, is that the case?
1 Like
Hi @michaelpurpura
Yes, it was a string type initially and I changed it to Date format for my need and I also tried by some calculated fields, but it is not fixing my issue.
I created a month and year filter and set the ‘create_date’ for last 45 days. Here my issue is it is picking the last 45 days from now(). I want to pick based on the month selected.
Hi Praveen,
You can achieve this without referring to the “Month” field, but using Parameters.
For example, create a parameter named “EndDate”. You can set the default to be the end of the current month.
Add a control for the parameter to your dashboard. You can format this to display as “MMM-YYYY” for example. Under this option, users would need to use the Date Picker control to choose the exact end date.
Once you have this established, you can add a filter against the Create_Date field. Ensure to use “Relative dates”, setting the Period to “Days” and the Range to “Last N days”. Here you can hard-code 45 days, however this can also be controlled by a different parameter.
In the same filter window, set the dates relative to “Date and time from a parameter”, and select the EndDate parameter that was previously created.
1 Like
Hi @praveen.gp, checking in to see if you had any questions on the above note?
1 Like
Thanks @michaelpurpura for the explanation.
and I got it through the below calculated field for my requirement.
ifelse({create_date}<=MONTH AND {create_date}>=addDateTime(-45, ‘DD’, MONTH), 1, 0)
1 Like