Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Alternate states issue

Hi all,

I have an alternate states expression that looks like this:

sum({PriorState<

MARKET_ID=$::MARKET_ID,

MFLAG=$::MFLAG

>}aggr(max(

{PriorState<

MARKET_ID=$::MARKET_ID,

MFLAG=$::MFLAG

>}

TOTAL_AMOUNT),ORDER_ID))

With MARKET_ID, it works fine. But if I add MFLAG, the value becomes 0. I can add other fields and they work, but not MFLAG. I investigated MFLAG and don't see anything wrong with it. It only has 2 values, YES and NO. Any ideas why a single field could stop the expression from working?

6 Replies
sifatnabil
Specialist
Specialist
Author

bump..

jonathandienst
Partner - Champion III
Partner - Champion III

I think you may need to provide a sample to illustrate your problem and to allow for diagnosis. My guess is that MFLAG is not properly associated with the other fields, or is misaligned, so selecting any MFLAG value deselects everything else. But that's just a guess.

Preparing examples for Upload - Reduction and Data Scrambling

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sifatnabil
Specialist
Specialist
Author

Thanks jontydkpi‌, very useful link. I found the issue was with null values in the fields. After replacing all null values with "N/A", it worked again. Is it common knowledge that alternate states cannot work with null values?

sunny_talwar

Is it common knowledge that alternate states cannot work with null values?

I have never heard of this before. I think in general null values are kind of a headache to handle within set analysis. But AFAIK, and I may be I am wrong, I don't think that it has anything to do with the use of alternate state.

sifatnabil
Specialist
Specialist
Author

I think it matters when you try to retrieve the values from another state, i.e. MFLAG=$::MFLAG - if there are nulls, it behaves strangely. Removing nulls fixed this for me.

sunny_talwar

Would you be able to share a small sample where we might be able to see this issue?