Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
mario_segal
Contributor
Contributor

100% Stacked Bar with Conditions on Set

I am trying to build a 100% stacked chart, however I have 2 filters on the chart that I applied as set conditions too

a specific quarter using a variable, and a specific  cross border grouping (we have 3 types), in addition I have a dimension of [Year Qtr] and a dimension of [Region] on teh chart - the region is for bar colors, and the quarter is because otehrwise I can't do the stacked (even though it is filtered to only one)

if I do this

sum ( { $<[Year Qtr]={"$(last_quarter)"}> +  <[Cross Border 3 Values]={'Intra'}> }  [Fraud Net Det Amt USD])

I get the correct values for my variable of interest

But when I add the divisor

sum ( { $<[Year Qtr]={"$(last_quarter)"}> +  <[Cross Border 3 Values]={'Intra'}> }  [Fraud Net Det Amt USD])

/

sum ( {$ <[Year Qtr]={"$(last_quarter)"}> +  <[Cross Border 3 Values]={'Intra'}>}  total [Fraud Net Det Amt USD])

I do not get the some of those values, so the % do not add upt o 100%

I understand the total is somehow negating the selections or one of them, but I do not know how to fix this

Any help will be appreciated

3 Replies
mario_segal
Contributor
Contributor
Author

I guess I figured out my question,

(sum ({$ <[Year Qtr] = {"$(last_quarter)"}, [Cross Border 3 Values]={'Domestic'}> }  [Fraud Net Det Amt USD]) )

/ (sum(total  { <[Year Qtr] = {"$(last_quarter)"},[Cross Border 3 Values]={'Domestic'}, [Iss Region]=>} [Fraud Net Det Amt USD]) )

Does anybody has a link to a good reference on set functions, it took me a while to find that [Iss Region]= will apply to total across that one only

Digvijay_Singh

This would be very helpful. I got it from community only, so credit goes to whoever shared it over here.

mario_segal
Contributor
Contributor
Author

Thanks, very useful document