Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 marunio007
		
			marunio007
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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?
 marunio007
		
			marunio007
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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))

 
					
				
		
 devarasu07
		
			devarasu07
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
Regards,
Deva
 marunio007
		
			marunio007
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you for your reply, but same result - no values on the output.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be this:
FirstSortedValue(Aggr(Count(Patient), VisitDate, Patient), -Aggr(VisitDate, VisitDate, Patient))
 marunio007
		
			marunio007
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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.050 | 2 | 
| 0.600 | 1 | 
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this
Dimension
=Num(Aggr(FirstSortedValue(Round(KFRE,0.025), -VisitDate), Patient), '#.000')
Expression
=Count(DISTINCT Patient)
 marunio007
		
			marunio007
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This, unfortunately won't be possible I think.... But I may be wrong and someone else might be able to assist....
 marunio007
		
			marunio007
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you so much for your help Sunny!
I'll keep on pounding at this for some time...
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Sure....One way I can think is to add triggers, but it can become a little messy...
