Adding an Integer to a Datetime to return a Datetime

Hello,

I’m looking to insert a formula into my metric set.

The result of my formula is blank and I think it has to do with data types.

The formula: (Integer/Percentage)+ DateTimeField

I’m hoping to get a datetime result, but its coming up as blank.

An example:

(50/.50) + 1/1/2019 should be 1/26/2019 but I’m getting nothing.

Let me know if you have any ideas

Hi Brandon,

The formula bar on the dashboard designer can only be used to return a measure. If you want to do something like this, do it in the data cube using a Calculated Element Transformation.

This should give you an idea of how to approach it if you’ve never used this before.

https://www.dundas.com/support/learning/documentation/cleanse-consolidate-modify-data/transforms/common/calculated-element

Jeff,

I tried doing this in the data cube, but I get the following error-

Data retrieval failed, as it was not possible to generate a valid query for the specified metric set.

In the data cube, i’m just adding two columns together. One is an int and the other a date. Not sure if that is the issue or not?

EDIT: Here is the formula I am using

DateTime date1 = $LastUpdateDate$;
return date1.AddMonths($DateDiff$);

Hi @brandon.maurer,

I was able to get this working using this code.

Do you have any nulls in your data that could be throwing an error? Perhaps you should test with some constants first.

return date1.AddMonths(1)… etc… see if there is an error.
you’ll also need to check $LastUpdatedDate$