Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

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
Specialist II
Specialist II
Author

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.

View solution in original post

20 Replies
Not applicable

Hi Nikhil,

Can you please attach your qvw sample here?

Thanks
Sabal

nikhilgarg
Specialist II
Specialist II
Author

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

senarath
Creator III
Creator III

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

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
Specialist II
Specialist II
Author

HEy,

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

Not applicable

Refer BlockChart tab in the container.

nikhilgarg
Specialist II
Specialist II
Author

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

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
Specialist II
Specialist II
Author

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