Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

nikhilgarg
Contributor III

SetAnalysis

Hello,

I have a Disaster Data having following Dimensions:

Disaster.Year , Disaster.Type , Disaster.Killed(Total Killed People for particular disaster) , StateData.Killed(Statewise killed people for particular disaster) , StateData.Location.

I want to create a bar chart showing the total killed people for different disasters in increasing order. i.e Total killed people by disaster1 , then disaster2 and so on.

I am using following set analysis but it is not giving me ryt output. Please solve the issue....

Sum({$<Disaster.Type = {"=rank(Sum(Disaster.Killed),4)<= 10"} > }Disaster.Killed)

1 Solution

Accepted Solutions
nikhilgarg
Contributor III

Re: SetAnalysis

HEy Sabal,

I got the difference. While using Rank i get top 10 only and while using Sum(Disaster.Killed) i am not restricted to 10. THanx but can you also explain the mode used in rank() like 1,2,3,4.  I go through the manual of rank() also but cann't get the use of mode.

20 Replies
Not applicable

Re: SetAnalysis

Hi Nikhil,

Can you please attach your qvw sample here?

Thanks
Sabal

nikhilgarg
Contributor III

Re: SetAnalysis

HEy , I have attached the qvw file , please have  a look on it and let me know the solution

senarath
Contributor III

Re: SetAnalysis

Hi,

You have used double quotation where as you should use single quotation for Disaster Type

Sum({$<Disaster.Type = {'=rank(Sum(Disaster.Killed),4)<= 10'} > }Disaster.Killed)

Double Quotes are used when putting search criteria.

thanx

Not applicable

Re: SetAnalysis

Hi Nikhil,

Cant you create a bar chart with Disaster.Type in Dimensions and expression as Sum(Disaster.Killed) and the sort the Dimension Disaster.Type with Y-value Ascending.

Let me know if this helps.

Thanks

Sabal

nikhilgarg
Contributor III

Re: SetAnalysis

HEy,

It does not make any difference. I tried with single quotation also.

Not applicable

Re: Re: SetAnalysis

Refer BlockChart tab in the container.

nikhilgarg
Contributor III

Re: Re: SetAnalysis

HEy Sabal ,

I tried the way u told me to do and it does help me. Thanx for that. But what if i want to do the same with rank(). Why it is not giving same result with rank(). Can you help me providing solution with rank() ??

Not applicable

Re: Re: SetAnalysis

Hi Nikhil,

Expression: Sum({$<Disaster.Type = {"=rank(Sum(Disaster.Killed),4)<= 10"} > }Disaster.Killed)

gives you the correct values(i.e., Top 10 Disaster Types based on sum of Disaster Killed.

However to get the values in increasing order, you would have to use the sort order.

So either you can sort it by Y-value as Ascending for the expression or

use below expression as sort order for Display Type:

Rank(-sum(Disaster.Killed),4)

Hope this clarifies.

Thanks

Sabal

nikhilgarg
Contributor III

Re: Re: SetAnalysis

HEy Sabal ,

Sum(Disaster.Killed) and Sum({$<Disaster.Type = {"=rank(Sum(Disaster.Killed),4)<= 10"} > }Disaster.Killed) both are working fine provided we check the option y vale ascending in sort tab. But exactly what dis Rank() does , i am still not clear about this. Thanx

Community Browser