Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to write an expression that returns/calculates the most recent available value based on a range of dates defined in a set analysis expression?
For example, if I have just two hospitals in a particular region and select April 2010 from my data island, the YTD licensed bed calculation based on the data below should return 140 for the region. (60 for Hospital1-March and 80 for Hospital2-April).
AsOfDate | Num of Licensed Beds | |
Hospital1 | 01/31/2010 | 52 |
02/28/2010 | 52 | |
03/31/2010 | 60 | |
Hospital 2 | 01/31/2010 | 74 |
02/28/2010 | 74 | |
03/31/2010 | 74 | |
04/30/2010 | 80 | |
05/31/2010 | 91 |
Here is the set analysis expression I am using for several other YTD calculations... {$<AsOfDate = {">=$(vCalCYrStart)<=$(vCalCMthEnd)"}>} where the variables vCalCYrStart and vCalCMthEnd are dynamically set based on a single selection from the data island.
Thank you in advance for any ideas or help you might be able to provide!
Try a nested set analysis expression
{$<AsOfDate={'date(max({$<AsOfDate = {">=$(vCalCYrStart)<=$(vCalCMthEnd)"}>} AsOfDate))'}>}
Regards.
Thank you for the quick response. I had to add an aggr to the formula to return the max available date by hospital and have part of it working at the moment. I must be missing some punctuation though because when I add the results of the nested max date expression to the outer set analysis expression, it returns zeros. I need to set this aside for the moment but will send an update if/when I get this working. Thanks again!