Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
garyvary123
Contributor III
Contributor III

Variable Date Range

Hi guys, I'm looking to make a few buttons that allow for the dates that I have in my data to be selected.

For example: I have a field called ReportingDate and I want to create an expression that selected YTD values.

vReportingDate = '>' (YearStart(Max(ReportingDate ))) & '<=' ((Max(ReportingDate )))

How can I make my variable select all the dates between these values? 

1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

I am not sure that I have completely understood the use case scenario, however my assumption is that you would like to create a button, that when clicked, it will select a specific range of dates from the dataset. In that case, you can follow the following steps:

 

1. I have the following dataset:

SCREENSHOT

 

2. I have created a button with the following configuration:

SCREENSHOT

Action: "Select values matching search criteria"

Field: [THE FIELD THAT YOU WANT TO APPLY THE SELECTIONS TO]

Value: ='>=$(=YearStart(Min(OrderDate)))<=$(=Max(AddYears(OrderDate, -3)))'

 

This is just a demo expression (to demonstrate the idea of how it works), that will select values where date is grater than the minimum date and lower than the maximum date (But 3 years earlier)

 

3. After clicking the button, this is what I get:

SCREENSHOT

As you can see, only specific date range was selected from the dataset.

 

4. In your use case scenario, you might try using the following expression:

='>$(=YearStart(Max(ReportingDate)))<=$(=Max(ReportingDate))'

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional details. Otherwise, if it has helped you resolve the issue, please mark it as accepted solution to give more visibility for other community members. 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

2 Replies
Andrei_Cusnir
Specialist
Specialist

Hello,

 

I am not sure that I have completely understood the use case scenario, however my assumption is that you would like to create a button, that when clicked, it will select a specific range of dates from the dataset. In that case, you can follow the following steps:

 

1. I have the following dataset:

SCREENSHOT

 

2. I have created a button with the following configuration:

SCREENSHOT

Action: "Select values matching search criteria"

Field: [THE FIELD THAT YOU WANT TO APPLY THE SELECTIONS TO]

Value: ='>=$(=YearStart(Min(OrderDate)))<=$(=Max(AddYears(OrderDate, -3)))'

 

This is just a demo expression (to demonstrate the idea of how it works), that will select values where date is grater than the minimum date and lower than the maximum date (But 3 years earlier)

 

3. After clicking the button, this is what I get:

SCREENSHOT

As you can see, only specific date range was selected from the dataset.

 

4. In your use case scenario, you might try using the following expression:

='>$(=YearStart(Max(ReportingDate)))<=$(=Max(ReportingDate))'

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional details. Otherwise, if it has helped you resolve the issue, please mark it as accepted solution to give more visibility for other community members. 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
garyvary123
Contributor III
Contributor III
Author

Perfect solution, thank you!