Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

How to use getfieldSelection in Aggr

Hi all,

With reference to discussion based on the link  Market Share Calculation Month Wise Market Share Calculation in QS .

I have multiple dimension in my pivot chart where as  I wanted to calculate market share based on many parameters

Like Company,Region1,RegionName,StateName,Territory  etc

Sum ([CY Sale])/aggr(nodistinct Sum ({<[Company]=>}[CY Sale]),MonthName)

So i want to use getfieldselection  dynamically when user will select  Company  then company wise market share will be calculated if user select Region1 then I should get Region1 wise MS.

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
4 Replies
sunny_talwar

May be this

Sum([CY Sale])/Sum(TOTAL <$(='[' & GetFieldSelections(FieldName, '], [') & ']')> {<Company>} [CY Sale])

or this

Sum([CY Sale])/Aggr(NoDistinct Sum({<[Company]=>}[CY Sale]), $(='[' & GetFieldSelections(FieldName, '], [') & ']'))
vikasmahajan
Author

Hi Sunny

Thanks for reply 

FieldName i have multiple in geographydrill (hierarchical drill)  how to use drill in this formula

Sum ([CY Sale])/aggr(nodistinct Sum ({<[Company]=>}[CY Sale]), MonthName , GeographyDrill )
Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
sunny_talwar

This

Sum([CY Sale])/Aggr(NoDistinct Sum({<[Company]=>}[CY Sale]), MonthName, $(='[' & GetFieldSelections(GeographyDrill, '], [') & ']'))
vikasmahajan
Author

Unfortunately this not working

my expression is

num(((Sum(Y2Sale)/aggr(nodistinct Sum ({<COMP=>}Y2Sale),Year,$(='[' & GetFieldSelections(ReportingHierarchy, '], [') & ']')))),'#,##0.0%') 

I am using ReportingHierarchy in drill of qlik sense.

Help appreciated.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.