Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
marunio007
Contributor III
Contributor III

Histogram with value intervals as dimension.

Hello,

I have the following fact table:

VisitDate, Patient, KFRE

KFRE is a numerical value between 0 and1.

I was able to create a nice simple histogram where chart dimension is =Round(KFRE, 0.025)  and expression is =Count(Patient) .

This gives me the number of visits with KFRE values within each KFRE interval for all the visits.

Since a patient can have more than 1 visit I need such histogram but only for the last patient's visit.

The expression would be something like this:

=Count({<VisitDate={$(=Max(VisitDate))}>}Patient)

but I am not getting any values on output.

What am I doing wrong?

1 Solution

Accepted Solutions
marunio007
Contributor III
Contributor III
Author

I have found a solution in this thread:Help with Set Analysis - MAX

The needed expression does not use set analysis:

=count(If(VisitDate=Aggr(Nodistinct Max(VisitDate),Patient),Patient))

View solution in original post

11 Replies
devarasu07
Master II
Master II

Hi,

Try like below,

=Count({<VisitDate={'$(=Max(VisitDate))'} >} Patient)

if it's not working, can you share your sample app with mock data. tks

also check this

Histogram example

Recipe for a Histogram

Regards,

Deva

marunio007
Contributor III
Contributor III
Author

Thank you for your reply, but same result - no values on the output.

sunny_talwar

May be this:

FirstSortedValue(Aggr(Count(Patient), VisitDate, Patient), -Aggr(VisitDate, VisitDate, Patient))

marunio007
Contributor III
Contributor III
Author

Thanks Sunny, but this does not seem to work...

In the attached sample I am looking to get this:

   

ROUND(KFRE,0.025)Last Visit KFRE Count
0.0502
0.6001
sunny_talwar

Try this

Dimension

=Num(Aggr(FirstSortedValue(Round(KFRE,0.025), -VisitDate), Patient), '#.000')

Expression

=Count(DISTINCT Patient)


Capture.PNG

marunio007
Contributor III
Contributor III
Author

Thank you Sunny.

This works, but it appears that Patient is now the dimension in the chart, not KFRE

When I make a selection in the chart I am selecting patients.

Is there a way to change this, so making a selection in the chart selects KFRE values?

Your help is greatly appreciated!

sunny_talwar

This, unfortunately won't be possible I think.... But I may be wrong and someone else might be able to assist....

marunio007
Contributor III
Contributor III
Author

Thank you so much for your help Sunny!

I'll keep on pounding at this for some time...

sunny_talwar

Sure....One way I can think is to add triggers, but it can become a little messy...