MDX Retention Rate - ssas

I am new to OLAP and I have a pretty tricky assignment that I am not sure is possible in MDX:
I work for an insurance company and I have been asked to provide a Retention Rate calculation to compare the number of policies we have kept from one time period to another.
The data in our fact table consists of a month-end snapshots of each our policies and there is a flag to indicate whether they are currently active at that time.
So, in plain English, the steps to find the Retention Rate from December 2014 to December 2015 would be:
Get the set of active policy IDs as of December 2014 (set #1)
Get the set of active policies as of December 2015 that have the SAME policy ID as set #1 (set #2)
Divide set #2 by set #1 to get the Retention Rate
I am just not sure if it is possible to compare specific IDs from two different sets like that in MDX.
Any help would be greatly appreciated!!

This isn't something one would normally use MDX for, since it involves a condition at the detail level (PolicyID), and MDX is all about data in aggregate.
However, if you are willing and able to add a flag to your fact table/view it can be done. To address your exact question, you could simply add a bit (or int) flag into your fact table. For each record, the flag would be true (1) if the PolicyID is active now AND was active a year ago, and false (0) if it was not.
Then you can add a new measure to your cube that counts "retained policies", which is just the sum of the flag you just added, and then you can easily divide one measure by another.
If your needs are more complex than this one instance, there might be ways to add more complex data, but the point is that you have to create a way for your cube to be able to compare aggregations.

Related

Edit 'no value' in crosstabs - Cognos Analytics dashboard

Is there a way to edit the 'no value' in the cells of a Cognos Analytics (11.0.13) dashboard crosstab visualization? I would like to change it into 0.
Thanks in advance.
My answer consists of two parts.
The first is of some techniques to do what you want to do. The second is of a caution about you really really need to understand the data to know if the values should be reported as zero rather than null.
Part the first
It depends on your data source and the provenance of the object.
If you are using a data module you can set a setting for the query item to replace the null with a zero.
If you are using an expression you could use the coalesce function to substitute a value then the source value is null. This could be used in place of whatever measure you are trying to use in your chart.
For example coalesce ( {some query item}, 0)
Coalesce takes any number of parameters and will return the value of those in the leftmost position unless it is null and then return the value for the next parameter, unless it is also null etc.
I'm assuming that you are using a file directly in the dashboard. My advice is that it might be a good idea to put it into a module, do your modelling there so that it is available in all your dashboards and reports and you can use it in conjunction with other data sources. Also, if you have a multi-sheet or multi-file source you have the ability to know how the relationships between the sheets were defined and correct them if need be. I have not had entirely good experiences with the soi disant smart relationship generation in multi-sheet files but you're using 11.0.13 and I don't think it's in there. (I'm using 11.1.5)
Part the second
For purists out there: A null is not a zero. There is a difference between a null and a zero. It's difficult for people without maths degrees (such as me, who trained as an accountant) to understand that but I have a fairly simple example which I think can show where a value is null and where it could be truly zero.
Assume that you are doing a month by month sales report for a car dealer. This time last year (i.e. in April 2019) you could be selling 2019 model year cars and some 2018 model year cars. You were not selling any 2020 model year cars because they were not released yet. In that case, the value ought to be null. Over time the number of sales of 2018 year cars would possibly be 0 as you would no longer have them in inventory to sell. In this pretend report I have a sale of 1 2018 car in February of this year.
Now, your report for 2019 will have nulls for the sales of 2020 year cars before the autumn (I think that's when they usually release new cars).
It is possible that the number of sale for April this year will be zero.
#E. van Dongen,
There is a way to set 'Missing value characters' property to '0' on Col Format option in CA 11.1.5 version. This option may be available in CA 11.0.13 as well.

MDX filter on fixed value depending on hierarcy level

I need to build a named set with mdx which tells me for a whole year what which are the large records. I cannot share my data, so I'll use a sales example.
All sales reps. need to enter their sales numbers in a application and on top of that database there is a cube configured. One of the goals is to find weird sales behaviour in this cube. This would mean a sales rep that is selling 100k every year, suddenly only sells 30k a year.
I have created a dynamic set that allows me to filter on this by using a calculated member named 'qualifies'. This qualifies is defined like this. (Diff is calculated before)
CREATE MEMBER Currentcube.qualifies AS iif(abs([Diff]) > 50000, 1, NULL),DISPLAY_FOLDER = 'Check big difference';
So this check can be used to filter all the sales reps that have a difference of 50k sales.
When I add aonther filter to my cube, for example region, the 50k threshold will never be exceeded, because no body has more than 50k sales in one region. I want to make the 50K dynamic based on my where clause in my filter.
My question is, is this possible? I'm fairly new to MDX so if this is an easy question, please forgive me. I have been trying lots of different scenario's but none gave a wanted result. I have been looking online, but this specific scenario hasn't passed in my search results.

Table design for payments

I have a table that holds data for a person who is on a project. The table has a Start date field a nullable End date field. So, a person is on a project from Start to End.
At the moment, they are always billable to the project. But I now have a new requirement that, for a period, they can be non-billable, yet, still working on the project. So, they have been assigned to the project, and are working, but for some reason, the client isn't billed for part of the period they are assigned, or maybe billed at a lower rate.
My idea is to have an exclusion type table, linked to the person assignment table which would have a start date, and end date, and a Rate column, which could be set to zero for no-charge, or else, works as an override value for a period.
Does this seem like valid design? As the person is billed 95% of the time, and probably will never had any exclusion, it makes more sense to me to have an exclusion table.
If anyone has an idea of how to do this better, it would be great.
At the moment, I also have a 'calendar' table, which I join to based on the start/end date of the person's schedule to get the daily rate. So, I could then join to the exclusion date as well, to see if there is an override of the rate?
Issues I might find with my design, are a lot of the joins are based on:
ON DateValue BETWEEN Start AND End
And I am not sure they're the most efficient joins.
If the exception could be one or more period of times (one-to-many) for one project then your design using an exclusion table is the best design.
Example:
June 1, 2013 to June 30, 2013
Exclusion:
June 9, 2013 - 0 Rate
June 25 to 27 - 30% of Original Rate
However, if the exclusion is possible and can only be a maximum of ONE single period (or one-to-one type of relationship) then you might instead put it on the same fields as other fields on project table.
Example:
June 1, 2013 to June 30, 2013
Exclusion:
June 9, 2013 - 0 Rate
I would use this "exclusion" table as single storage for person-project occupation data. In case when person is assigned to project one time without changes in rate, you will have one record in this table. In other cases you will have a history of rate changes in this table.
It looks like your are allowing discount on standard rate to the customer for specific period. for such case, you can set the rate to be negative eg.-$100/hours for the duration to set resource rate for free in your discount/exclusion table. you can find the final rate for that resource for particular period by adding your discount amount and standard amount to get net amount. In your design, you have already mentioned the relation will be made between exclusion and person assignment table. your design will allow to show what discount has been given to the customer. This approach is ok when your are adjusting the billing for exception cases.
In case, your are trying to do correction in project billing, IMO, you should have separate entries in person assignment table for each rate with the duration.
While generating Invoice to the customer, you can show adjusted discounted rate or new revised billing based on the correction.

Discritization Based on a Calculated Measure in Tabular Mode

I am currently trying to implement the following scenario on Tabular Mode SSAS, appreciate your support.
We have a fact table of Transactions that is the linked to the customer dimension, and we have a measure called Frequency that shows the number of times the user used his card during the selected period (The fact table is also linked to Date Dimension). What we need to do is create a dimension that would have the frequency groups as follows (For example, 1 to 5, 5 to 10 , 10 to 15 and 15 & Above). The problem here is that I am unable to link the Fact table to this dimension becuase the link between them would be a calculated measure.
Any thoughts?
Thanks and Best Regards
Omar Sultan
If you want to link the fact to a bucket dimension, you are going to have to specify the time granularity. I would suggest that you decide one or more useful periods (day, week, month) and create a facts (or several) to bucket your data at the appropriate grain.
This solution will lose flexibility from your original request, as the user will not be able to dynamically select the time period for the bucket, however they will gain from being able to compare fixed time periods to identify trends over time.

Calculated Member for Cumulative Sum

First some background: I have the typical Date dimension (similar to the one in the Adventure Works cube) and an Account dimension. In my fact table I have daily transaction amounts for the accounts.
I need to calculate cumulative transaction amounts for different accounts for different periods of time. The catch is that whatever is the first period shown on the resulting report should get its transaction amount as-is from the fact table and all the following periods in the report should have cumulative amounts.
For example, I might have a single account on rows and on columns I could have [Date].[Calendar].[Calendar Year].[&2005]:[Date].[Calendar].[Calendar Year].[&2010]. The transaction amount for 2005 should have the sum of transaction amounts that took place in 2005 for that specific account. For the following year, 2006, the transaction amount should be TransactionAmountsIn2005 + TransactionAmountsIn2006. Same goes for the remaining of the years.
My problem is that I don't really know how to specify this kind of calculated member in the cube because the end-user who is responsible for writing the actual MDX queries that produce the reports could use any range of periods on any hierarchy level of the Date dimension.
Hope this made some sense.
Teeri,
I would avoid letting the end-user actually write MDX queries and just force them to use ranges you defined. To clarify, just give them a start and end date, or a range if you will, to select and then go from there. I've worked with accounting and finance developing cubes (General Ledger, etc) for years and this is usually what they were ultimately looking for.
Good luck!