Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I will post 3 images, each having a table and a line chart.
The used data is exactly the same (it's using the same measure and the same dimensions).
PROBLEM:
1a. the data shown, before any selection, is wrong both in the table and in the line chart (see 1st image).
1b. After a selection is made (click on a point in the line chart - *without confirming* the selection), the data is correct in the table (see 2nd image).
1c. After a selection is made (click on a point in the line chart - *with confirming* the selection), the data is correct both in the table and in the line chart (see 3rd image).
QUESTION: why is the data displayed before any selection is wrong and after selection is correct? How to fix it?
1st image
2nd image
3rd image
The problem are the 2 variables vDateStart and vDateEnd. They are the MIN and MAX of Datum (not the "datum" used in the formula posted above). But the issue is that, for some reason, the variables do not get correctly calculated when they are used in the formula mentioned above:
LET mNewCustomerCount | = 'SUM(' & Chr(36) & '(setActuals) IF([datum] >= ' & Chr(36) & '(vDateStart) AND [datum] <= ' & Chr(36) & '(vDateEnd), c_distinct_count))'; |
Not sure how to fix the problem, but that is the problem. I used hardcoded dates in the formula, instead of using the variables vDateStart and vDateEnd, and the results were correct. It might be a Qlik Sense bug, not sure.
what is the expression that you are using?
Hi,
would you be able to attach sample QVF file ?
Hey, thanks for the replay. The date is the measure and the dimension is:
LET mNewCustomerCount | = 'SUM(' & Chr(36) & '(setActuals) IF([datum] >= ' & Chr(36) & '(vDateStart) AND [datum] <= ' & Chr(36) & '(vDateEnd), c_distinct_count))'; |
wish I could, but no. thanks anyway
why you are complicating things!
remove the if else condition and put it in the set analysis:
sum({<datum={">=$(vDateStart) <=$(vDateEnd)"}>}c_distinct_count)
what is in setActuals?
setActuals = it's a flag for this year or last year.
But the behavior is strange, don't think the formula is wrong. Why does it show correct results when I specifically select a date, and wrong results when the dates are NOT selected....?
I never use if else in expression
always try to put all login in set analysis format
The problem are the 2 variables vDateStart and vDateEnd. They are the MIN and MAX of Datum (not the "datum" used in the formula posted above). But the issue is that, for some reason, the variables do not get correctly calculated when they are used in the formula mentioned above:
LET mNewCustomerCount | = 'SUM(' & Chr(36) & '(setActuals) IF([datum] >= ' & Chr(36) & '(vDateStart) AND [datum] <= ' & Chr(36) & '(vDateEnd), c_distinct_count))'; |
Not sure how to fix the problem, but that is the problem. I used hardcoded dates in the formula, instead of using the variables vDateStart and vDateEnd, and the results were correct. It might be a Qlik Sense bug, not sure.