Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
t_donnet
Partner - Creator
Partner - Creator

IF statement takes over measure

Hello,
 
I was wondering if this Qlik Sense behaviour is normal.
 
The mesaure contains an if statement :
If(Dim1 = 'A'
, calculation
, If(Dim1 = 'B'
, calculation
, If(Dim1 = 'C'
, calculation
)))
 
Each calculation have a range of date of 1 year.
 
At the opening of the app, dafautl selection is set up
- Always one value selected (Dim1)
- The last 30 days (Qlik Dashboard bundle - Date Picker)
 
Result in chart
The if statement takes over from the measure and show only the last 30 days dimensions
 
Expecting result
The measure should bypass the dimension and show on 1 year
 
In attachement, a demo app 
 
How to avoid this behaviour?
 
Thanks for your help
Théo
Labels (1)
1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

The RnD team has confirmed that this is working as designed. It appears that one expression is a valid aggregation where the SET statement propagates as for all the aggregated values, whereas the other expression is a scalar operation where the SET statement is applied within each inner expression of the if-statements.

 

Additionally, the RnD team has stated that, the aggregation; "Sum({< ... >} ...)", contain a SET expression that is applied to the full (outer) expression, while the scalar expression; If(..., Sum({< ...>} ...), If(..., Sum({< ...>} ...), If(..., Sum({< ...>} ...))), contain one (or more) SET expressions that are evaluated within each conditional (inner) expression.

 

Logically these are very different from each other, and while the SET statement of the (outer) aggregation is applied to the full cardinality of the dimension, the scalar (inner) expressions are applied to the cardinality segments of the dimension as filtered by the if-statements.

 

I hope that this information is helpful! 

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

View solution in original post

8 Replies
Andrei_Cusnir
Specialist
Specialist

Hello,

 

The issue is with the default bookmark within the app. It appears that you have created the bookmark when there were no any selections applied, and thus when the app is opened the default bookmark is applied, most probably, after the "Always one selected option" and it messes up with the generated data on the chart. There are 2 ways of resolving this issue:

 

Option 1:

1. Delete the default bookmark

2. Reload the app and you will see that the charts should display the right data

 

Option 2:

1. If you want to keep the default bookmark

2. First delete it

3. Refresh the app

4. Now that the one value for Dim1 is selected and the charts display the right data, create a new bookmark

5. Apply "Save layout"

6. Mark the bookmark as default

7. Refresh/Reopen the app

8. This will open the app, will apply the selections and as soon as the bookmark will be used it will apply the same selections again, which means that the view will be set to the correct one

 

This is the view that I get when opening the app for the first time after applying Option 2:

 

As you can see, both charts display the right data.

 

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! 🙂
t_donnet
Partner - Creator
Partner - Creator
Author

Hi Andrei,

thanks for your info. Tried your propositions and didn't work out for this case.

You are missing an important part. In the default selection, there is two field set on:

- One field with "one value selected"
- The field date (The last 30 days).

It's with the date field that reduced the dimension while that the measure is on 1 year.

Be aware if you use the calcultation only without the if statement. The chart display correctly.

Regards,
Théo

 

 

Andrei_Cusnir
Specialist
Specialist

Hello,

 

Thanks for pointing this out. I have definitely missed that. Please take a look at my steps below and let me know if I am missing any other points as well:

 

1. I have deleted the default bookmark and cleared all selections


 

Dim1 has still the value as it has the option "Always one selected value enabled"

 

2. I have then selected from the Date picker "The last 30 days" and I got the range 04/04/2022 - 27/04/2022

 

In that case, the first chart is shows only one dot, while the second chart displays a line.

 

3. I have created a new bookmark and set it as default

 

4. I have refreshed the app and I can see:

 

The first Line chart still shows one dot and the second Line chart shows a full graph. 

 

Can you please clarify with me if you see the same outcome on your side by following again the steps shared above? In case you have different outcome, can you please share with us screenshot of the different outcome?

 

 

 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
t_donnet
Partner - Creator
Partner - Creator
Author

Hi Andrei,

Following your steps I have the same result.

 

The aim is to arrive in the first chart at the same result as the second chart, while taking into account the Dim1 and Date selection.

Use the details (measure and the set analysis) in the text box to understand that the measure has a range of 1 year in the set analysis.

In the second chart, the measure does not contain an if statement, which is why the line appears throughout the chart.

While the first chart, the measure contain an if statement and doesn't display many values.

I hope that these info/details will help you.

Regards,
Théo

Andrei_Cusnir
Specialist
Specialist

Hello,

 

Thank you very much for sharing with me this information. I now understand what exactly is the issue that you are facing. Since the expression is the same in both Line charts, it is expected to see the same graph, however this is not the case. 

 

I have created an internal investigation with the RnD team so they could take a look at this use case scenario. The internal reference number is QB-10329. I will monitor the investigation for a few days and if we see that it requires additional time to be addressed, we can create an article that will be used to monitor for updates.

 

Thank you very much for reporting this behavior

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

Hello,

 

The RnD team has confirmed that this is working as designed. It appears that one expression is a valid aggregation where the SET statement propagates as for all the aggregated values, whereas the other expression is a scalar operation where the SET statement is applied within each inner expression of the if-statements.

 

Additionally, the RnD team has stated that, the aggregation; "Sum({< ... >} ...)", contain a SET expression that is applied to the full (outer) expression, while the scalar expression; If(..., Sum({< ...>} ...), If(..., Sum({< ...>} ...), If(..., Sum({< ...>} ...))), contain one (or more) SET expressions that are evaluated within each conditional (inner) expression.

 

Logically these are very different from each other, and while the SET statement of the (outer) aggregation is applied to the full cardinality of the dimension, the scalar (inner) expressions are applied to the cardinality segments of the dimension as filtered by the if-statements.

 

I hope that this information is helpful! 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
t_donnet
Partner - Creator
Partner - Creator
Author

Hi Andrei,

thanks for those details. We learn everyday!

Is it possible to bypass the inner expression ? 
If not, your answer  will be the solution

Thanks again

Regards,
Théo

 

 

Andrei_Cusnir
Specialist
Specialist

Hello,

 

It seems that it is not possible to bypass the inner expression for now, due to how Qlik Sense is working. However you can raise a feature request [1], to ask for improvement of how the graph is displayed in this particular use case scenario. 

 

I hope that this information is helpful.

---

[1] https://community.qlik.com/t5/Knowledge-Base/How-To-Submit-Feature-Requests-For-Qlik-Products/ta-p/1...

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