Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is my requirement, like using a date to filter some dimensions.
The default date range is working well. But I need some dimension selections to change the date range based on that dimension level.
Example: Default Date Range
From is 02/20/2023
To is 02/21/2024
User requirement: Selected some dimension values,
like Name (Raja), it should display the employee joining date is 03/05/2023 termination date is 09/06/2023
Before:
From is 02/20/2023
To is 02/21/2024
After:
From is 03/05/2023
To is 09/06/2023
it would be a combination of the min and max of the date field.
Creating variable could help you in this specific case.
// Default date range
vFromDate = Date('02/20/2023', 'MM/DD/YYYY');
vToDate = Date('02/21/2024', 'MM/DD/YYYY');
// Flag for dimension selection
vNameSelected = 0;
The use below expression for set it
// For charts using the default date range
Sum({<DateField={">=$(vFromDate)<=$(vToDate)"}>} Sales)
// For charts adjusting the date range based on the selected Name
Sum({<DateField={">=$(=if(vNameSelected, Date('03/05/2023', 'MM/DD/YYYY'), vFromDate))<=$(=if(vNameSelected, Date('09/06/2023', 'MM/DD/YYYY'), vToDate))"}>} Sales)
then once a selection done trigger to set vNameSelected to 1 when a Name is selected
SET vNameSelected = 1;
Can adjust the variables created based on selection
// Adjust the date range based on the selected Name
IF vNameSelected THEN
SET vFromDate = Date('03/05/2023', 'MM/DD/YYYY');
SET vToDate = Date('09/06/2023', 'MM/DD/YYYY');
ELSE
SET vFromDate = Date('02/20/2023', 'MM/DD/YYYY');
SET vToDate = Date('02/21/2024', 'MM/DD/YYYY');
END IF;
This will dynamically adjust the date range based on the selected dimensions