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: 
Not applicable

Syntax for alternate state with conditions

Hello,

I need to do a distinct count on Seq# when Payer Type = 'T' for State1 and State2. Here is what I'm using...

=Count({State2}{$<[Payer Type]={T}>} DISTINCT([Seq#]))

From what I can tell this formula renders all states, not just State2. Do I have my syntax incorrect?

Please let me know.

Thanks so much.

BW

1 Solution

Accepted Solutions
Not applicable
Author

I tweaked what you had a little and I think this is it. Just in case anyone reads this here is the final winning combo!

=Count({State2 * $<[Payer Type]={T}>} DISTINCT([Seq#]))

Rob - thank you so much. It's so nice to be able to bounce these dilemma's off others:) Much appreciated.

BW

View solution in original post

6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You have too many braces. Should be:

Count({State2<[Payer Type]={T}>} DISTINCT([Seq#]))


-Rob

Not applicable
Author

It looks like it changes by state now but when I select other filters it's disregarding them. So here's what I now have...

=Count({State2<[Payer Type]={T}>} DISTINCT([Seq#]))

Do I need to add $ somewhere to ensure the inherited filters apply?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think it's back to your original syntax but with "*" between the sets:

=Count({State2 * $<[Payer Type]={T}>} DISTINCT([Seq#]))


Note corrected syntax.

Not applicable
Author

I tweaked what you had a little and I think this is it. Just in case anyone reads this here is the final winning combo!

=Count({State2 * $<[Payer Type]={T}>} DISTINCT([Seq#]))

Rob - thank you so much. It's so nice to be able to bounce these dilemma's off others:) Much appreciated.

BW

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Glad to help. Don't forget to mark something (including your own response ) as correct to close the thread.

-Rob

Not applicable
Author

Rob - how would this formula look if I didn't need to define payer type = T but wanted all filters not in State2 to apply?