How to summarize aging data into age grouping in SAP WebI - webi

Using WebI 4.2, I am trying to summarize aging data for individual unit into Aging Group distribution for Material Number as shown below. I am getting either #MultiValue or weird numbers displayed. I'll need some help on how can I get the desired outcome.
Raw Data
Desired outcome

My approach is to create a variable called Aging Category...
=If([Aging (Days)] <= 10; "Aging (0 - 10 days)";
If([Aging (Days)] <= 20; "Aging (11 - 20 days)";
If([Aging (Days)] <= 30; "Aging (21 - 30 days)";
If([Aging (Days)] <= 40; "Aging (31 - 40 days)";
"Aging (> 40 days)"))))
You may or may not know that Web Intelligence allows two types of syntax for If...Then...Else statements. I prefer the one above, but this is equivalent...
=If [Aging (Days)] <= 10 Then
"Aging (0 - 10 days)"
ElseIf [Aging (Days)] <= 20 Then
"Aging (11 - 20 days)"
ElseIf [Aging (Days)] <= 30 Then
"Aging (21 - 30 days)"
ElseIf [Aging (Days)] <= 40 Then
"Aging (31 - 40 days)"
Else
"Aging (> 40 days)"
Put that in for the column header of your crosstab. Then create a varible to count your units...
=Count([Serial Number])
That goes in the body of the crosstab.
That should do it.

Related

SAS Proc IML Simulate from empirical data with limits

This might sound bonkers, but looking to see if there are any ideas on how to do this.
I have N categories (say 7) where a set number of people (say 1000) have to be allocated. I know from historical data the minimum and maximum for each category (there is limited historical data, say 15 samples, so I have data that looks like this - if I had a larger sample, I would try to generate a distribution for each category from all the samples, but there isn't.
-Year 1: [78 97 300 358 132 35 0]
-Year 2: [24 74 346 300 148 84 22]
-.
-.
-Year 15:[25 85 382 302 146 52 8]
The min and max for each category over these 15 years of data is:
Min: [25 74 252 278 112 27 0 ]
Max: [132 141 382 360 177 84 22]
I am trying to scale this using simulation - by allocating 1000 to each category within the min and max limits, and repeating it. The only condition is that the sum of the allocation across the seven categories in each simulation has to sum to 1000.
Any ideas would be greatly appreciated!
The distribution you want is called the multinomial distribution. You can use the RandMultinomial function in SAS/IML to produce random samples from the multinomial distribution. To use the multinomial distribution, you need to know the probability of an individual in each category. If this probability has not changed over time, the best estimate of this probability is to take the average proportion in each category.
Thus, I would recommend using ALL the data to estimate the probability, not just max and min:
proc iml;
X = {...}; /* X is a 15 x 7 matrix of counts, each row is a year */
mean = mean(X);
p = mean / sum(mean);
/* simulate new counts by using the multinomial distribution */
numSamples = 10;
SampleSize = 1000;
Y = randmultinomial(numSamples, SampleSize, p);
print Y;
Now, if you insist on using the max/min, you could use the midrange to estimate the most likely value and use that to estimate the probabilty, as follows:
Min = {25 74 252 278 112 27 0};
Max = {132 141 382 360 177 84 22};
/* use midrange to estimate probabilities */
midrange = (Min + Max)/2;
p = midrange / sum(midrange);
/* now use RandMultinomial, as before */
If you use the second method, there is no guarantee that the simulated values will not exceed the Min/Max values, although in practice many of the samples will obey that criterion.
Personally, I advocate the first method, which uses the average count. Or you can use a time-weighted count, if you think recent observations are more relevant than observations from 15 years ago.

VBA solution of VIF factors [EXCEL]

I have several multiple linear regressions to carry out, I am wondering if there is a VBA solution for getting the VIF of regression outputs for different equations.
My current data format:
i=1
Year DependantVariable Variable2 Variable3 Variable4 Variable5 ....
2009 100 10 20 -
2010 110 15 25 -
2011 115 20 30 -
2012 125 25 35 -
2013 130 25 40 -
I have the above table, with the value of i determining the value of the variables (essentially, different regression input tables in place for every value of i)
I am looking for a VBA that will check every value of i (stored in a column), calculate the VIF for every value of i and output something like below
ivalue variable1VIF variable2VIF ...
1 1.1 1.3
2 1.2 10.1

DAX help: % monthly share of another table

I have a DAX formula for my Powerpivot I cannot get to solve and was hoping for help.
I have two pivot tables connected already
Showing a cohort of actions taken within Month 1,….X on the sign up month
Total Sign Ups on monthly basis
I have tried to attached the sheet here but somehow I cant so I have add a screenshot of the sheet.1
What I have so far is:
=DIVIDE(
SUM(Range[conversion to KYC completed]),
SUM('Range 1'[Sum of signups]))
But this does not give me what I want as I think I’m missing the monthly grouping somehow.
Question 1:
What I want is to get the share of actions completed within 1,...,X months out of the total sign up that given month (e.g. Jan) (so the data from Table 2)
Question 2:
In best case I would also like to show total sign ups in the beginning of the cohort to make the cohort easier to understand, so having the monthly total sign up (which the cohort is calculated based on). But now I cannot get just the totals month by month. Is there anyways just to add in a monthly total column in the pivot without applying these number as a value across all columns?
Something like this is the ultimate outcome for me 2
UPDATED WITH SAMPLE DATA
Signup month, KYC completed month, Age by month, signups, conversion to KYC completed
Jan-17 Jul-18 18 97 75
Jan-17 Jul-18 18 99 79
Jan-17 Dec-18 23 95 80
Feb-17 May-18 15 99 74
Feb-17 Jul-18 17 90 75
Feb-17 Jul-18 17 95 76
Feb-17 Aug-18 18 92 71
Mar-17 May-18 14 94 73
Apr-17 Jul-18 15 93 75
May-17 Sep-18 16 94 70
May-17 Oct-18 17 98 72
Jun-17 May-18 11 95 79
Jul-17 Oct-18 15 97 74
Jul-17 Jul-18 12 94 78
Aug-17 Sep-18 13 96 74
Sep-17 Nov-18 14 95 80
Sep-17 Oct-18 13 94 79
DESIRED OUTCOME
The % for Month 1....X is calculated KYC Completed / Monthly Sign up
OUTPUT WITH THIS CODE
=VAR SignUpMonth = IF(HASONEVALUE('Range 1'[Row Labels]), BLANK())
RETURN
DIVIDE(CALCULATE(SUM([conversion to KYC completed])),
CALCULATE(SUM('Range 1'[Sum of signups]),
FILTER(ALL(Range), Range[Signup month (Month Index)] = SignUpMonth)))
[
Thanks for the sample data Franzi. Still not too clear what you're asking for, but perhaps this will help a little.
Signed Up to Signed In Ratio =
VAR SignUpMonth = SELECTEDVALUE(Table1[Signup month], BLANK())
RETURN
DIVIDE(CALCULATE(SUM([conversion to KYC completed])),
CALCULATE(SUM(Table1[ signups]),
FILTER(ALL(Table1), Table1[Signup month] = SignUpMonth)))
So. Let's break it down.
If I understand correct, you want to see the cross section of number of signins for a given month ( x axis ) signup combo ( y axis ) and divide that number by the total signups ( y axis ) per signup month.
number of signins for a given month ( x axis ) signup combo ( y axis ):
CALCULATE(SUM([conversion to KYC completed]))
TOTAL signups ( y axis ) per signup month
CALCULATE(SUM(Table1[ signups]),
FILTER(ALL(Table1), Table1[Signup month] = SignUpMonth))

Aging Bucket DAX formula issue

I have a table as stated below,
MEM_ID dateDiff
4522 10
111 1
1112 -1
1232 5
121135 20
145 30
12254 60
I want a Dax formula which will give the output as stated below under measure column as
MEM_ID dateDiff Measure
4522 10 0-15 Days
111 1 0-15 Days
1112 -1 <0 Days
1232 5 0-15 Days
121135 20 15-30 Days
145 30 15-30 Days
12254 60 >60 Days
I have used this formula which didnt worked, any help much appriricated =IF(MAX([DateDiff]) <= 1, "0", IF(MAX([DateDiff])>=1 && MAX([DateDiff])<15,"1-15 Days",IF(MAX([DateDiff])>=15 && MAX([DateDiff])<30,"15-30 Days",IF(MAX([DateDiff])>=30 && MAX([DateDiff])<60,"30-60 Days",IF(MAX([DateDiff])>=60 && MAX([DateDiff])<90,"60-90",BLANK())))))
Using a lookup-table like Ian Ash suggests is better, but if you must use an IF formula, Try the formula you have, but delete the MAX functions.
=IF([DateDiff]< 1, "0",
IF([DateDiff]>=1 && [DateDiff]<15,"1- 15 days",
IF([DateDiff]>=15 && [DateDiff]<30,"15-30 Days",
IF([DateDiff]>=30 && [DateDiff]<60,"30-60 Days",
IF([DateDiff]>=60 && [DateDiff]<90,"60-90",
BLANK())))))
I would solve this problem by creating a look up table as follows.
Create a new worksheet called Lookup, then starting from A1 add the following data:
Min Max Bucket Description
-1000 0 1 <0 Days
1 15 2 0 - 15 Days
16 30 3 16 - 30 Days
You can add additional rows if you need to add more buckets. For example, to create a bucket for 30 to 60, you would add the row:
31 60 4 30 - 60 Days
Once you have the lookup table defined, you can reference into it using the following formula from your main worksheet:
=OFFSET(Lookup!$A$1,SUMPRODUCT((B2>=Lookup!$A$2:$A$4)*(B2<=Lookup!$B$2:$B$4)*(Lookup!$C$2:$C$4)),3)
In the above formula, the value being looked up is in B2.
If you have added rows to your lookup table, you will need to extend the look up range in the formula, i.e. Lookup!$A$2:$A$4 changes to Lookup!$A$2:$A$5 and so on.

Ageing Formula without having column for No of Days

Doc. Date Aging (days) Aging class
10/06/2010 1820 121+ Days
09/30/2015 0 0 - 30 Days
09/11/2015 19 0 - 30 Days
09/11/2015 19 0 - 30 Days
09/11/2015 19 0 - 30 Days
09/11/2015 19 0 - 30 Days
I want to add ageing grop in Column without having Ageing Days. So can i have help in calculating it in single column instead of 2 steps.
formula for no of days is
=IF(ISBLANK(H4),"",'Ex. rate'!$G$2-I4)
formula for ageing group is
=IF(J4<=30,"0 - 30 Days",IF(J4<=60,"31 - 60 Days",IF(J4<=90,"61 - 90 Days",IF(J4<=120,"91 - 120 Days","121+ Days"))))
Warning it is long:
=IF(ISBLANK(H4),"",IF('Ex. rate'!$G$2-I4<=30,"0 - 30 Days",IF('Ex. rate'!$G$2-I4<=60,"31 - 60 Days",IF('Ex. rate'!$G$2-I4<=90,"61 - 90 Days",IF('Ex. rate'!$G$2-I4<=120,"91 - 120 Days","121+ Days")))))
alternatively: (without nested if's but need always the same range)
=IF(I4="","",CHOOSE(MIN(MAX(TRUNC(('Ex. rate'!$G$2-I4-1)/30)+1,1),5),"0 - 30 Days","31 - 60 Days","61 - 90 Days","91 - 120 Days","121+ Days"))
(changed H4 to I4) ...still works perfectly for me. Don't know how it can be wrong... sorry :/

Resources