Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
newdev22
Contributor
Contributor

Expression for Heirarchy

Hi All,

I am having difficulty in writing an expression for heirarchy.

The requirement is, I have a heirarchy (having 4 dimensions - zone, state, district,office) as my dimension in the (treemap) chart. I have to write an expression for sales in such a way that  for Zone and state sales will be in TMT which is sum(sales)/1000 and for district and office sales will be in MT which is sum(sales). Problem is how to split this Heirarchy in expression editor.

Let me know if you have any idea to get this.

Thanks!

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

You Can create a variable which holds the value you want to divide.

Say for example vDivide

vDivide = If(Getselectedcount(Office)>=1,1, If(Getselectedcount(District)>=1,1,1000))

Now divide your expression with variable

Sum(Sales)/$(vDivide)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

When you say Hierarchy, is it that you have created a drill down dimension? or you have 4 different dimensions?

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
newdev22
Contributor
Contributor
Author

Its a drill down dimension.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

You Can create a variable which holds the value you want to divide.

Say for example vDivide

vDivide = If(Getselectedcount(Office)>=1,1, If(Getselectedcount(District)>=1,1,1000))

Now divide your expression with variable

Sum(Sales)/$(vDivide)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!