Forum Discussion
Cumulative Growth Factor in SSAS Tabular model
Hi Guys,
I am facing new challange in Cumulative Growth Factor in SSAS Tabular model.
below are the steps.
below is the data:
| ID | Activation_Date |
| 1777230002 | 2/22/18 0:00 |
| 1777230003 | 2/22/18 0:00 |
| 1777270029 | 2/27/18 0:00 |
| 1778070068 | 3/7/18 0:00 |
| 1778070069 | 3/7/18 0:00 |
| 1778060060 | 3/6/18 0:00 |
| 1778060065 | 2/22/18 0:00 |
| 1778100080 | 3/17/18 0:00 |
| 1778060063 | 2/27/18 0:00 |
| 1778110081 | 3/24/18 0:00 |
| 1777230001 | 2/22/18 0:00 |
| 1777260028 | 2/22/18 0:00 |
| 1778030040 | 3/3/18 0:00 |
| 1778040041 | 2/22/18 0:00 |
| 1778140098 | 3/14/18 0:00 |
| 1778120086 | 3/31/18 0:00 |
| 1778120088 | 3/31/18 0:00 |
| 1778130092 | 2/22/18 0:00 |
| 1778120084 | 3/10/18 0:00 |
| 1778120089 | 3/12/18 0:00 |
step 1 : Customer_Count:= count(ID)
step2 :cumulative_Customer:= CALCULATE(COUNT(CLIENT_SERVICE_SETUP[CLIENT_ID]),
FILTER(ALLSELECTED('CLIENT_SERVICE_SETUP'),CLIENT_SERVICE_SETUP[ACTIVATION_DATE]<=MAX(CLIENT_SERVICE_SETUP[ACTIVATION_DATE])))
Step 3: Cumulative_Growth:= calculate(divide(customer Count,cummulative_Customer))
below is the output data.
| Month | Cumulative Growth | cumulative Customer | Customer Count |
| Feb-18 | 1 | 43 | 43 |
| Mar-18 | 0.52222222 | 90 | 47 |
| Apr-18 | 0.23728814 | 118 | 28 |
| May-18 | 0.25316456 | 158 | 40 |
| Jun-18 | 0.08139535 | 172 | 14 |
| Jul-18 | 0.04972376 | 181 | 9 |
| Oct-18 | 0.04232804 | 189 | 8 |
| Nov-18 | 0.015625 | 192 | 3 |
| Jan-19 | 0.00518135 | 193 | 1 |
| Feb-19 | 0.01025641 | 195 | 2 |
| Mar-19 | 0.01515152 | 198 | 3 |
| May-19 | 0.06603774 | 212 | 14 |
My Requirement is : (customer count/cumulative customer), the results are good. but need small change in above requirement.
my Requirement: Customer_Count/lag(Cumulative_Customer)
1)
may-18: customer_Count: 47
Feb-18: cummulative_Customer: 43
calculation is : 47/43.
2)
Apr-18: customer_Count: 28
Mar-18: cummulative_Customer:90
calculation : 28/90
I am not able to get : Customer_Count/lag(Cumulative_Customer) how to achieve this result.
would some one help me in this regards,
Please let me know if you need any more details.
Regards,
SKM
9 Replies
- v-alq-msft
Community Support
Hi, Anonymous
Based on your description, you may click 'Edit Query', go to Query Editor, choose 'Add Column' ribbon, select 'Index Column', click 'Close and Apply'.Then you may create the measure as follows.
return CALCULATE( SUMX( ALLSELECTED('Table'), DIVIDE( CALCULATE( SUM('Table'[Customer Count]), 'Table'[Index] = _index+1 ), SUM('Table'[Cumulative Customer]) ) ))Result:
If I misunderstand your thought, please show me your expected output. I am glad to solve the problem for you.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Allan,
Thanks a lot for your great help. your understanding is correct but DAX which you shared not able to execute in SSAS tabular cube. in my requirement i need to add 1 more point that we need to implement cumulative total on Month & Quarter
formula :
Curren_month[cummulative_customer]-previous_month[cummulative_Customer]/previous_month[cummulative_Customer]
example:
Jan-18: cummulative_Customer: 47
Feb-18: cummulative_Customer: 43
calculation: 43-47/43
Note: we need to consider only cummulative_customer measure.
i have attached pbix file with to get more clarity.
https://www.dropbox.com/s/a92hq4dqejykhg1/Client_Details.pbix?dl=0
would you please let us know any more details required.
Regards,
SKM
- AnonymousNot applicable
I believe you can use DATEADD()
I.e. growth = [Customer Count] / CALCULATE( [Customer Cummulative], DATEADD( Calendar[DateDateTime], -1, MONTH))
If this works then please mark it as the accepted solution.
- AnonymousNot applicable
Hi Nskv,
Thanks a lot for your great help!
provide DAX query works fine, in my requirement i have to drill up value(Measure) for year, Quarter and Month in Line chart visual. to get that, Dateadd function hope we can't specify month, we have to find other options to get generic date where i can drill down to year, Quarter and Month. would you please help me in this regards.
Regards,
SKM
- AnonymousNot applicable
Try this:
value cummulative (t-1) = VAR __dateFilterM = STARTOFMONTH( 'DimCalendar'[DateDateTime]) VAR __dateFilterQ = STARTOFQUARTER( 'DimCalendar'[DateDateTime]) VAR __dateFilterY = STARTOFYEAR( 'DimCalendar'[DateDateTime]) RETURN CALCULATE( [value]; FILTER( ALL('DimCalendar'); SWITCH( TRUE(); ISFILTERED( 'DimCalendar'[CalendarMonthName]); 'DimCalendar'[DateDateTime] < __dateFilterM; ISFILTERED( 'DimCalendar'[CalendarQuarterName]); 'DimCalendar'[DateDateTime] < __dateFilterQ; 'DimCalendar'[DateDateTime] < __dateFilterY ) ) )