Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
kermitt
Contributor III
Contributor III

Display another interval of dates inside a chart when I select a unique date in datePicker

Hi every body,

I want to display all values of a climatic temperatures of  weather stations since they began to do measures.

In fact I have a filter in which I put the [Weather_Station_name]

I have put a datePicker inside my sheet in order to select a unique date (for example : 02/02/2022

Well, some weather stations have data from very deep time so I can't roll back inside the  datePicker to go to the beginning of the weather station. But I have inside a fied name [Weather_Station_Open_Date] the date of its opening.

How can I select all the items in order to display inside my chart.

I thougth using the date Picker was a solution but I monder if I could use an input box to enter the date and then it could select all the datas by using [Weather_Station_Open_Date].

Do I have to do this by using a set analysis or anything else ?

Does anybody can help me ?

Thanks a lot

1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

I am not 100% sure that I have understood the use case scenario, however please allow me to share with you some information that could possibly help you resolve the issue. If this is not the entire solution for the use case scenario that you have, at least, it will help you get on the right path.

 

You have stated that you want to display all the values (since the beginning) based on specific selected date value. So I assume that what you need is to show all the values up until the selected date.

 

I would recommend to go with 3 Variable input objects, to make it simpler:

 

1. I have the following fake dataset:

IMAGE

 

2. As you can see there are 2 stations with random values for dates going back to 2015.

 

3. Create 3 variables:

IMAGE

 

4. Create 3 Variable inputs:

IMAGE

 

For the configuration:

  • Appearance > Variable > Name => Use the variables that you have created accordingly
  • Appearance > Variable > Show as => Drop down
  • Appearance > Values > Fixed or dynamic values => Dynamic

For the expressions I have used:

  • Day: =Concat(DISTINCT Num(Day(Date)), '|')
  • Month: =Concat(DISTINCT Num(Month(Date)), '|')
  • Year: =Concat(DISTINCT Year(Date), '|')

These expressions will construct the list of possible values for each selection, based on the data that is present within the dataset. You can however create a list with all the possible values, regardless of the dataset such as "1|2|3|4 ..." and "2015|2016|2017 ..." etc.

 

5. Now for the Table chart I have added the first 2 dimensions and for the last one I have used the dimension expression: 

=If(

  Date >= Min(TOTAL Date
  and 
  Date <= MakeDate('$(vYear)', '$(vMonth)', '$(vDay)'),
  
  Date(Date, 'DD/MM/YYYY'), 
  
  Null()
  
)

 

This expression checks if the date is between the range of the first date in the dataset and the selected date from the Variable inputs. If the condition is met, then the date itself is returned, otherwise return Null().

 

6. Then if we un-check the option  "Include null values", the output is:

IMAGE

 

As you can see, only the data for the dates within the timeframe are displayed. If you also want to limit the data based on the stations, then you can create another Variable input for the stations and add " Station = '$(vStation)' " part to the If()'s condition so the results will be limited to the one station. You can get the idea behind the logic and modify the expressions based on your needs.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to 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 100% sure that I have understood the use case scenario, however please allow me to share with you some information that could possibly help you resolve the issue. If this is not the entire solution for the use case scenario that you have, at least, it will help you get on the right path.

 

You have stated that you want to display all the values (since the beginning) based on specific selected date value. So I assume that what you need is to show all the values up until the selected date.

 

I would recommend to go with 3 Variable input objects, to make it simpler:

 

1. I have the following fake dataset:

IMAGE

 

2. As you can see there are 2 stations with random values for dates going back to 2015.

 

3. Create 3 variables:

IMAGE

 

4. Create 3 Variable inputs:

IMAGE

 

For the configuration:

  • Appearance > Variable > Name => Use the variables that you have created accordingly
  • Appearance > Variable > Show as => Drop down
  • Appearance > Values > Fixed or dynamic values => Dynamic

For the expressions I have used:

  • Day: =Concat(DISTINCT Num(Day(Date)), '|')
  • Month: =Concat(DISTINCT Num(Month(Date)), '|')
  • Year: =Concat(DISTINCT Year(Date), '|')

These expressions will construct the list of possible values for each selection, based on the data that is present within the dataset. You can however create a list with all the possible values, regardless of the dataset such as "1|2|3|4 ..." and "2015|2016|2017 ..." etc.

 

5. Now for the Table chart I have added the first 2 dimensions and for the last one I have used the dimension expression: 

=If(

  Date >= Min(TOTAL Date
  and 
  Date <= MakeDate('$(vYear)', '$(vMonth)', '$(vDay)'),
  
  Date(Date, 'DD/MM/YYYY'), 
  
  Null()
  
)

 

This expression checks if the date is between the range of the first date in the dataset and the selected date from the Variable inputs. If the condition is met, then the date itself is returned, otherwise return Null().

 

6. Then if we un-check the option  "Include null values", the output is:

IMAGE

 

As you can see, only the data for the dates within the timeframe are displayed. If you also want to limit the data based on the stations, then you can create another Variable input for the stations and add " Station = '$(vStation)' " part to the If()'s condition so the results will be limited to the one station. You can get the idea behind the logic and modify the expressions based on your needs.

 

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

 

 

 

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

Hello @Andrei_Cusnir 

What such a reply. Let me few days to try this solution and I'm bring you a back.
Very Thanks a lot to have took time to propose.

Warm regards