Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tom2qlik
Creator
Creator

Chart Expression High Level Detail Showing Null

Hi All,

I am trying to show the percentage of people who are present within the boundaries of greater than 0.5 but less that 5.

This is within a pivot table.

The first statement below works when the chart is expanded to the lowest level of detail.  However when the detail is collapsed only a null appears.

Expression (Present %)

if (SUM({<[Present]={"True"}>}[Number])/SUM(People)*100 > 0.5
and SUM({<[Present]={"True"}>}[Number])/SUM(People)*100 < 5,
SUM({<[Present]={"True"}>}[Number])/SUM(People), Null())

Detail:

    

High Level:


I need the High level value to show the average of the rows with values i.e. 0.50 and 0.58

I have been playing around with the aggregation function but with no joy.

avg(aggr(
if(sum(sum({<[Present]={"True"}>}[Number])/Sum(People)*100) < 5
and sum(sum({<[Present]={"True"}>}[Number])/Sum(People)*100) > 0.5,
Sum({$<[Present]={"True"}>}[Number])/Sum(People))
,
sum([Present])/Sum(People)))

Could someone point me in the right direction as to where I'm going wrong?

Thanks in Advance

1 Solution

Accepted Solutions
sunny_talwar

Try this:

avg(aggr(

if(sum({<[0-7TodayPresentFlag]={"True"}>}[<7TodayPresent])/Sum(People)*100 < 5

and sum({<[0-7TodayPresentFlag]={"True"}>}[<7TodayPresent])/Sum(People)*100 >= 0.5,

Sum({$<[0-7TodayPresentFlag]={"True"}>}[<7TodayPresent])/Sum(People)),

Location, Room))


Capture.PNG

View solution in original post

5 Replies
sunny_talwar

Try this:

Avg(Aggr(

If(Sum({<[Present]={"True"}>}[Number])/Sum(People)*100 > 0.5
and Sum({<[Present]={"True"}>}[Number])/Sum(People)*100 < 5,
Sum({<[Present]={"True"}>}[Number])/Sum(People), Null())


, HouseNumber))

vishsaggi
Champion III
Champion III

Can you share a sample app and expected out put for this please ?

tom2qlik
Creator
Creator
Author

I have attached a sample QVW with the data included.

The screenshot below might explain better.

The top 2 charts have the range conditions applied in the expression.  The top left chart only shows rooms which have a value within the range of > 0.5 and < 5%.  The top right is the same chart but "rolled up".  It is showing the sum of the location as 0.78%.  However it should show 0.91 which is the average of room 2, 3, 4 percentages.

The bottom 2 charts are without the range conditions.  Room 1 is now displayed as it falls outside the range and the chart is showing everything.  The bottom right chart is same as the bottom left just "rolled up".  It is also showing the value of 0.78% which is correct for this chart as its the average of rooms 1, 2, 3 and 4.

I hope that makes sense.

Also the below expression has the same result as above.

avg(aggr(
if(sum({<[0-7TodayPresentFlag] = {"TRUE"}>}[<7TodayPresent])/sum(People)>0.0005
and sum({<[0-7TodayPresentFlag] = {"TRUE"}>}[<7TodayPresent])/sum(People)<0.05,
sum({<[0-7TodayPresentFlag] = {"TRUE"}>}[<7TodayPresent])/sum(People), Null()),
Room))

 
Thanks



sunny_talwar

Try this:

avg(aggr(

if(sum({<[0-7TodayPresentFlag]={"True"}>}[<7TodayPresent])/Sum(People)*100 < 5

and sum({<[0-7TodayPresentFlag]={"True"}>}[<7TodayPresent])/Sum(People)*100 >= 0.5,

Sum({$<[0-7TodayPresentFlag]={"True"}>}[<7TodayPresent])/Sum(People)),

Location, Room))


Capture.PNG

tom2qlik
Creator
Creator
Author

Thank you!