Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
TinaHensel
Contributor III
Contributor III

Manually add dates to dimension

Hello together,

I am facing the following issue: I am creating a dimension for a line chart with the if-statement below. So if the value of date_1 is smaller than the value of date_2, I want to put the weekstart of date_1 as dimension value. Else I want to manually add the 3 dates of date_3, date_4 and date_5 to my dimension.

 

if
(
   date_1 < date_2
   , weekstart(date_1)
   , ValueList(date_3,date_4,date_5)

)

 

 

Any ideas how this can work?

Thank you very much!!!

Best regards

Tina

 

1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

If my understanding is correct, I believe that your use case scenario is not possible. Based on Dimensions [1] documentation we can see that "Dimensions determine how the data in a visualization is grouped" and this grouping is done based on the data that you have loaded to your application. This means that in order to perform any analysis on the data, this data would have to be already loaded and processed. 

 

Qlik Sense allows you to do this process from the Data load editor or from Data manager, where it will create the proper connections with the data source, load the needed data and then link the data. This process is not possible inside the Analyze section, where you can only analyze the already loaded data. The reload task needs to be executed in order for the data to appear in the dataset, which is only possible with Data load editor and Data manager.

 

Additionally, keep in mind that when you use expressions in your charts, those expressions are being evaluated every single time that there is an update. Therefore, if you have a simple expression as you have shown above, that generates values in the dataset, this means that every time there is an update in the view, those dates will be added. 

 

For example imagine this statement: If 23/04/20201 < 24/04/2021 then add dates 26/04/2021, 27/04/2021, 28/04/2021

Therefore, whenever there is an update (Such as title editing, sorting, reordering, colors etc.), this expression will be evaluated and it will always be true. Therefore, every time the date values 26/04/2021, 27/04/2021, 28/04/2021 would have been added, generating duplicates in the dataset.

 

As you can see, this is not possible and it is not something that could be implemented. I would suggest to generate all the dates that you need in your Data load editor with a script, but in the Charts just present the dates that you need based on if statement or set analysis.

 

I hope that this information was helpful 

 

---

[1] https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Dimensions/dimensions.htm

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

View solution in original post

1 Reply
Andrei_Cusnir
Specialist
Specialist

If my understanding is correct, I believe that your use case scenario is not possible. Based on Dimensions [1] documentation we can see that "Dimensions determine how the data in a visualization is grouped" and this grouping is done based on the data that you have loaded to your application. This means that in order to perform any analysis on the data, this data would have to be already loaded and processed. 

 

Qlik Sense allows you to do this process from the Data load editor or from Data manager, where it will create the proper connections with the data source, load the needed data and then link the data. This process is not possible inside the Analyze section, where you can only analyze the already loaded data. The reload task needs to be executed in order for the data to appear in the dataset, which is only possible with Data load editor and Data manager.

 

Additionally, keep in mind that when you use expressions in your charts, those expressions are being evaluated every single time that there is an update. Therefore, if you have a simple expression as you have shown above, that generates values in the dataset, this means that every time there is an update in the view, those dates will be added. 

 

For example imagine this statement: If 23/04/20201 < 24/04/2021 then add dates 26/04/2021, 27/04/2021, 28/04/2021

Therefore, whenever there is an update (Such as title editing, sorting, reordering, colors etc.), this expression will be evaluated and it will always be true. Therefore, every time the date values 26/04/2021, 27/04/2021, 28/04/2021 would have been added, generating duplicates in the dataset.

 

As you can see, this is not possible and it is not something that could be implemented. I would suggest to generate all the dates that you need in your Data load editor with a script, but in the Charts just present the dates that you need based on if statement or set analysis.

 

I hope that this information was helpful 

 

---

[1] https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Dimensions/dimensions.htm

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