Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Conditional count of field in text object based on expression held in variable.

Hi,

I have a text object (# of IRs) that I want to display the distinct count of CHANGE_ID based on an expression where the CHANGE_ID's TOTAL SCORE is <= 7. The expression works in a Pivot Chart but when I put the expression into a variable (v_total_score) and bake that into the text object, it only counts when you drill to one CHANGE_ID.

The below image shows what I'm trying to do.

qv problem.JPG

9 Replies
Anil_Babu_Samineni

May be this?

Count({<CHANGE_ID = {"=sum(TOTAL CHANGE_ID)<=7"} >} distinct CHANGE_ID)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi Anil,

When I use Count({<CHANGE_ID = {"=sum(v_total_score)<=7"} >} distinct CHANGE_ID) it counts all CHANGE_ID's and doesn't filter out those where the TOTAL SCORE is <= 7.

I'm wondering if I need to use Aggr() in here somewhere?

Thoughts?

Thanks,



Jason

Anil_Babu_Samineni

I don't think you need any aggregation over expression. Can you show where and how you are declare the variable

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

See below. Something to consider, the v_total_score variable works in a text object when a single CHANGE_ID is selected but shows '-' when more than one is selected.

qv problem.JPG

vinieme12
Champion III
Champion III

Try

=Sum ( TOTAL  AGGR( YOUREXPRESSION , CHANGE_ID ) )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anil_Babu_Samineni

Please attach file to test

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi Anil, did you attach it?

Anil_Babu_Samineni

No, I am asking please attach some sample application to test

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Here you go.