In this blog post, I want to share an idea of how you can generate month-to-date (MTD), quarter-to-date (QTD), and year-to-date (YTD) values in SAP Data Warehouse Cloud. This is only one way, I think there are several other ways how you can solve this issue. I am happy to discuss your ideas in the comment section.

 

Control Table

The starting point is a control table that has the following structure:

Source Month Target Month Target Value
1 1 MTD
1 1 YTD
1 2 YTD

The whole table has entries for each source month.

Data Table

After we have now the control table for the calculation, we now create a view. This is what the data looks like:

data%20preview

data preview

 

Data Model

Now we have the data and the calculation table, we just create a simple join to the data, which you see in the following screenshots.

join

join

join%20settings

join settings

 

Output

Output

Output

 

SAC Output

With the value type, we can now filter our data for MTD/QTD/YTD and the corresponding month. In the SAC, it will look like this:

SAC%20Output

SAC Output

 

In this example, I filter my data for June, and so I see directly the aggregated values. For the MTD you see the month value of 578881,24. For the QTD you get the values for the second quarter of the year and for the YTD you get the values of the entire year.

MTD%20values

MTD values

 

As you see, it works perfectly and is very fast. I had a similar post where I used this logic in one on Premise SAP HANA DB.

What do you think about this solution? I know this is only one approach and there are more out there. Maybe someone has a better solution?

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x