Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Distinct values from different columns

Hi ,

I have a table in database like this

ZoneIdregioniddistrictidterritoryidTTerritoryTDistrictTRegionTZone
52120710413300215550475879
526111413407182172362475879
526110213400172362475879
120666122240029560233082247206
12066692136034129233082247206
12066692136034129233082247206
12066692136034129233082

247206

i have 4 list boxes Zone,Region,District and Territory in my dashboard,if i will select Zone in the list box the distinct value will display in the pivot table from TZone column in the database.

Like this if i will select Region in the list box,the distinct value will display from TRegion column in the database and so on....

I wrote the expression in pivot table like this:

=(if(GetFieldSelections(Zone)>=1,sum(distinct{$<flag={'mrktshare'},CommonYear={$(VmaxYear-1)},CommonMonthNo={$(VmaxMonth)}>}TZone),

if(GetFieldSelections(Region)>=1,sum(DISTINCT{$<flag={'mrktshare'},CommonYear={$(VmaxYear-1)},CommonMonthNo={$(VmaxMonth)}>}TRegion),

if(GetFieldSelections(District)>=1,sum(DISTINCT{$<flag={'mrktshare'},CommonYear={$(VmaxYear-1)},CommonMonthNo={$(VmaxMonth)}>}TDistrict),

if(GetFieldSelections(Territory)>=1,sum(DISTINCT{<flag={'mrktshare'},CommonYear={$(VmaxYear-1)},CommonMonthNo={$(VmaxMonth)}>}TTerritory),1

)))))

It is working for Zone selection after i will select Region still it is showing Zone Value,if i will deselect the Zone it is showing Region Value.

How can i achieve this in QlikView based on selections in the list box calling the distinct values in different columns.

I am struggling past from 4 days,can some one guide me in this how to achieve this..

Regards,

baru

9 Replies
Not applicable
Author

Hi All,

Can some one help me in this........

Regards,

baru

sureshbaabu
Creator III
Creator III

Hello,

Can you try creating multiple expressions(one for each) and display the appropriate based on 'Conditional' option

Thanks

tresesco
MVP
MVP

In a first look, GetFieldSelections() returns a string, I guess you have to use getselectedcount() instead.

Not applicable
Author

Hi tresesco,

thanks for your reply,

i tried getselectedcount() also, but it's not working.can i have some alternate way to do this...

Not applicable
Author

Hello Suresh,

i have 8 conditions form 8 tables,so i looking to do this in one expression .

tresesco
MVP
MVP

Could you post a sample app that demonstrates the issue?

sureshbaabu
Creator III
Creator III

just try the following:

expression 1:

Conditional: = GetSelectedCount(ZoneId)=1

Definitional: = sum( DISTINCT TZone)

expression 2:

Conditional: = GetSelectedCount(regionid)=1

Definitional: = sum( DISTINCT TRegion )

Thanks

Not applicable
Author

Hi Tresesco,

Thanks for the reply,

getselectedcount() is working but we need to pass this in every condition.so that it will work...

Anonymous
Not applicable
Author


Can you please share your qvw with some sample data.....