Dynamic Date calculated field

Hello Everyone,

I need assistance with a calculated field involving two date parameters: a start date and an end date.
The goal is to filter the data based on these parameters and also to use them in calculated field.

Here’s how it should work:

  • If the date range is filtered from May 26 to June 25, the calculated field should reflect June’s data.
  • If the date range is from June 26 to July 25, it should reflect July’s data.
  • If the range is from July 26 to August 25, it should reflect August’s data.
  • If the range is from August 26 to September 25, it should reflect September’s data so on

I need help creating this calculated field based on the criteria outlined above.

Thank you!

Best,
Vaibhav

Hi @Vaibhav.narwade

It appears only the End date matters as the Month and Year of the End date seems to be considered in the filter.

What’s with the 26th to 25th range. What is the significance. What happens if I select May 1 to May 31 or May 15 to Jun 15?

Regards,
Giri

Hi @Giridhar.Prabhu ,

If the data is filtered using the regular method, it will display month-wise data as per your request.
For example, filtering from May 1 to May 31 will show data for the month of May.
However, if someone filters the data from May 26 to June 25, it will display data for the month of June.

Best,
Vaibhav

Hi @Vaibhav.narwade,

Based on two date parameters you can create a From and To Date range based on calculated fields as follows. I am just creating the values here.

Since the filters can be based on parameters and not calculated fields you need to create another calulated field to produce a boolean (1 or 0) result by checking your datasets date field to be between the two date values from the following calculated fields and filter that calculated field for a value = 1 to get your visuals working fine.

Result:

Hope this helps.

Regards,
Giri

2 Likes

Hello Vaibhav.narwade, Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community Q&A Forum!

Hello @Giridhar.Prabhu ,

image (3)
As shown in the snapshot, I would like to clarify my request. From January to April, we can follow the 1st to the 30th (or 31st) of each month. However, starting in May, we need to implement the logic indicated above.
I need to incorporate the monthly headcounts using the specified date range logic.
For Headcount I have a separate month-wise field.

Best,
Vaibhav.

Hi @Vaibhav.narwade

Is the head count coming from a different table with a month field?

1 Like

Hi @Giridhar.Prabhu,

No, those items are on the same table.

Can you provide some sample data of your dataset?

We can evaluate both logics for the date range from May to December.

  1. 26th may - 25th June = June month
  2. 1 June - 30/31 June = June month
    This data will be filtered based on the Start date and End date parameters, including headcount. For headcount, I have a month-wise fields.
    January headcount,
    February headcount and so on…

Apologies, I want to clarify that the headcount is being sourced from a different table.

How do you join your Billing table to Head Count table? I guess what you are trying to do is more to do with the join between the tables than on the visualization

If you could simulate some sample data for the two tables and how you have setup the dataset then I can take a look

2 Likes


By using date parameters, we can obtain the headcount on a monthly basis.


We can select any date range to get the respective headcount and values as well.
Is this sufficient information, or do you need more?

Hi @Giridhar.Prabhu,

thank you.
I am going with another approach.

Best,
Vaibhav

Hi @Vaibhav.narwade

Based on your description my original reply with the FromFilterDate and ToFilterDate should work for all your cases. You can give it a try on a smaller dataset and try.

Regards,
Giri

Hi Vaibhav @Vaibhav.narwade ,

If Giridhar’s suggestion worked for you, please mark it as solution. If you are still having problems, please create a sample analysis in Arena with mock data and include link to it along with clear explanation on the numbers you expect to see for various data filter combinations. This will help the community take a better stab at solving your problem.

Regards,
Arun Santhosh
Pr QuickSight SA

1 Like

@Giridhar.Prabhu
@ArunSanthosh
@murili

Thank you