on 2023 Sep 20 4:29 PM
Hi
I am looking how to create MTD calculation and YTD calculation in my model for invoice sales. I know how to achieve this in the story but I want to create in my model so I don't need to create each time in a story.
Thanks
peersbrennanctb
The below should work for YTD. [GROSSAMOUNT] is the original measure for which YTD will be calculated. Till now I have used this for model level YTD calculation.
ITERATE(IF([d/Date].[p/MONTHDESC]="Jan" ,0 , PRIOR () ) + [GROSSAMOUNT], [GROSSAMOUNT], [d/Date].[p/CALMONTH])
For MTD and even YTD you can use the newly introduced ToPeriod dynamic time calculation at model level in recent QRC release. Refer to the SAP Note – 3365184 also for details.
https://blogs.sap.com/2023/09/14/whats-new-in-sap-analytics-cloud-release-2023.19/
YTD
LOOKUP([GROSSAMOUNT] ,[d/CREATEDAT]=ToPeriod("Year" ) )
MTD
LOOKUP([GROSSAMOUNT] ,[d/CREATEDAT]=ToPeriod("Month" ) )
I ran some test as below
Hope this helps !!
Br.
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Peers,
Try the below steps:
MTD Calculation:
a. In your model, go to the "Models" tab.
b. Click on "Edit Model."
c. In the "Measures" section, click on "Add Measure."
d. Name your measure (e.g., "MTD Sales").
e. In the formula section, use a formula similar to the following:
SUM([Sales]) WHERE ([Date] >= FIRSTDAYOFMONTH(TODAY()) AND [Date] <= TODAY())
This formula calculates the sum of sales for the current month.
YTD Calculation:
a. In your model, go to the "Models" tab.
b. Click on "Edit Model."
c. In the "Measures" section, click on "Add Measure."
d. Name your measure (e.g., "YTD Sales").
e. In the formula section, use a formula similar to the following:
SUM([Sales]) WHERE ([Date] >= FIRSTDAYOFYEAR(TODAY()) AND [Date] <= TODAY())
This formula calculates the sum of sales for the current year.
Save the model and use it in stories.
Thanks,
Lakshmi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.