Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a variable in qlikview where I am calculating top 1 country.
Now I am using this variable to display the sales of each state for the country from the variable.
So if the variable name is vCountry.
I am using this statement in Dimension of Pie Chat:
If(country = $(vCountry), State)
But thsi is not working.
I need help in resolving this.
Please help me here.
Thanks
Hi Avinash,
Thanks for your help.
I realized that I was doing wrong thing. My expression in variable was not working fine. I do not know why. Because when I use that variable in List Box, I was getting one value. But when I used that variable in Text Box, It was not showing any result.
Now I am using the below expression in my variable:
only(if(aggr(Rank(Sum([Sales Amt])),Country)=1,Country))
and I am getting country name in Text Box and List Box both. (THIS IS FOR TESTING THAT MY VARIABLE IS WORKING FINE)
Now I am using this variable as Sunny has suggested and am getting the result.
I am very thankful to all for your valuable time and suggestion.
What about this:
If(country = vCountry, State)
If(country = $(vCountry), State)
Should work. Check value of your variable. Can you share your qvw file..
Hi Sunny,
Thanks for your help.
But it is not working.
Thanks
How is vCountry gets its value?
Hello,
change it into
If(country = '$(vCountry)', State)
Regards
Hope 'country' spelled correctly
Hi Sunny, Yes, the variable vCountry is getting value from Country field only. It is dynamic value based on the other filter selection.
Now I want to compare this variable value with the Country Field and get the sum of sales for this country value.
Hi Martin, when I am using this, I can see that qlikview is replacing '$(vCountry)' with the formula I have written in variable.
Ideally it should calculate the formula and then replace '$(vCountry)' with the result of formula. But this is not happening.
This is the rootcause why this is not working.
So if you are already making selection in Country field, I would expect this chart to drill down to only show states for the countries you have selected. Why do you need an if statement here?