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: 
adiarnon
Creator III
Creator III

Set Analysis (selection)


hi,

i have this expression-

COUNT({<PROJECT={"=Aggr(Sum({<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}ActualCurrentBook_$(vFinanceFormula)),PROJECT)>0
and
Aggr(Sum({<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}ActualCurrentBook_$(vFinanceFormula))/Sum({<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}BudgetCurrentBook_$(vFinanceFormula)),PROJECT)>=1"
}
>}
DISTINCT PROJECT)

the expression is working!

but i whant that if im making a selection in a field (like PROJECT) The expression will ignor the selection

how can i do that?


9 Replies
tresesco
MVP
MVP

I would suggest to check if the Aggr() within the set is really giving you the expected output. I would be doubly sure of this is right at all. Once you get rid if this aggr(), may be by just including 'PROJECT=' in the max() (probably) that you use in variable vMaxBudgetVersion definition.

If you are in doubt, try to create a qvw with sample data and share here (and, please don't forget explain your expected output against that data).

PrashantSangle

Hi,

Use TOTAL keyword,

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
adiarnon
Creator III
Creator III
Author

hi,

i cheked the aggr and its working!

about the - vMaxBudgetVersion ITS A VARIABLE that contain string not an expression.

so, i dont think its the solution.

i thought about like the $ (current selection) and 1 (all values)

but i sont know if its possible and if it is so where should it be,...

Not applicable

Try this


COUNT($(=if(len(getfieldselection(PROJECT))=0,'{<PROJECT={"=Aggr(Sum({<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}ActualCurrentBook_$(vFinanceFormula)),PROJECT)>0
and
Aggr(Sum({<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}ActualCurrentBook_$(vFinanceFormula))/Sum({<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}BudgetCurrentBook_$(vFinanceFormula)),PROJECT)>=1"
}
>}',''))
DISTINCT PROJECT)


You check if the Project have a selected field, than you give the Setanalysis otherwise it will give back a empty string.

adiarnon
Creator III
Creator III
Author

tnx,

cam you help me

where should i insert the total?

adiarnon
Creator III
Creator III
Author

but i want that it will always bring somthing back!

Not applicable

Oh sorry missunderstanding.

You can use the Set Idetifier 1.

count({1<Pro....> Distinct PROJECTS)

This means that every selection will be Ignored ... 

adiarnon
Creator III
Creator III
Author

I TRIED-

COUNT({1<PROJECT={"=Aggr(Sum({1<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}ActualCurrentBook_$(vFinanceFormula)),PROJECT)>0
and
Aggr(Sum({1<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}ActualCurrentBook_$(vFinanceFormula))/Sum({1<[BUDGET VERSION]={$(vMaxBudgetVersion)},PROJECT=>}BudgetCurrentBook_$(vFinanceFormula)),PROJECT)>=1"
}

>} 
DISTINCT PROJECT)

NOT WORKING =(

Not applicable

May you can provide your QVW, than it would be easier to help ...