Dynamic year range on loss triangle
Is it possible using Cube data to calculate the minimum policy year?
The client is the main driver (but there are more slicers) and is made up of policies where the policy year comes from in the column headers.
The challenge is that when some years have no premium or claims it affects the presentation of the triangle. I have tried CoalesceEmpty and it fills in the missing ranges, but then goes further than the range of the policy year and you get results where it starts from 2002 for a client we only started working with in 2020.
It's not clear from your description what the desired output should be.
Do you want the years between the start and end years where there is no data filled in with zeros or do you want the previous year value copied into the the years with with no data?
Also, how do you determine the starting year if the starting year has no premiums or claims?
OK, making some assumptions here:
1. When you say "Cube" data you are referring to SSAS OLAP or Tabular cubes;
2. You want to display the Range to be dynamic based on the first and last year that contains data;
3. You want any years within that range that have no data to be displayed, with blank or zero shown in the cell.
Here is one approach.
1. Here's a report showing my Incurred measure for each Accident year. As you can see, if I use show Empties to see the years that have no Incurred measure values, I see all my Accident years form the past to the future, as well as the years that have no Incurred value between the minimum and maximum years. I want to show only the years, min to max including empty years, but excluding years below min and above max.
2. Create a dynamic list that contains the first and last year that contains data:
The Nonempty filter removes all years where there is no value for Incurred Measure.
**NOTE: Where you want to filter by Client as the major driver, I would recommend you make the Client filter a parameter and include that parameter in the NonEmpty filter. It may be you have to treat the other slicer attributes the same way. It kind of depends on your data.
I use two streams, the upper stream selecting the First element in the list of Years with a value of Incurred, and the lower stream selects the Last Year with a value of Incurred. I then Union the two streams to give me a dynamic list which contains the first and last Year.
3. Build another dynamic list that is the RANGE of Years, starting from the First element (item(0)) and ending with the second element from the List (item(1)). Unfortunately you will need to resort to the Script mode to do this, using the List of two elements we created previously, the MDX RANGE operator, ":" (MDX uses this operator rather than a "RANGE" function like PQL) and the .item() suffix to pick the elements from the list we want (.item() starts at 0):
As you can see in the Preview pane, this gives us a list of Years from the Min to the Max and everything in between.
4. Use this List in your Discover view, making sure you have the "Show Empties" button selected to show the empty years within the range.
Hope my assumptions matched reality and that helps. Otherwise LMK.
While you can certainly use multi level Hierarchies as parameters, currently the Hierarchy Tree in the drop down widget visualisation is not supported for Parameters. You won't see it in the visual options. For example, I can select the top level and all descendants in my Dates Hierarchy for my Parameter:
But the visualisation options are limited:
However, all members from all levels are displayed and can be selected, just not in the nice collapsible way you would like:
The explanation as to why is rather long winded and technical. It has been raised as an enhancement request in the Product Ideas Forum and we keep it under review.
Hope that helps.