cancel
Showing results for 
Search instead for 
Did you mean: 

Absolute Value for the Difference between 2 Dates

sherif_elkoumy
Participant
0 Kudos

Hello Lumira experts,

I need to calculate just the absolute value for the difference between two dates. I get values in minus and plus but it does not matter. I just need the delta and continue my analysis. Please see the picture. I searched for a function under functions but could not find anything.

Any help!!!1

regards, Sherif

Accepted Solutions (1)

Accepted Solutions (1)

varunanand
Contributor
0 Kudos

Hi Sherif,

First create the difference dimension (diff) as,

DateDiffInDays({Ship Date}, {Order Date})

Then create a new dimension with absolute values as,

if {diff} < 0 then {diff} * (- 1) else {diff}

You can convert this later to a measure if required. Please let me know if there are any questions or comments.

Thank you,

Varun Anand

sherif_elkoumy
Participant
0 Kudos

Hi Varun,

many thanks, your solution works although one-step solution could be better

varunanand
Contributor
0 Kudos

Hi Sherif,

I agree. In fact, Tammy's option of using Abs function would be one step. But you would be creating a formula measure (create custom calculation) in the visualize room as it supports aggregation functions. This would then have the limitation of not being available as a dimension.

Thank you,

Varun Anand

Answers (1)

Answers (1)

TammyPowlas
Active Contributor
0 Kudos

Can you put the Abs function around your difference calculation?  See below

sherif_elkoumy
Participant
0 Kudos

Hi Tammy,


"Unknown function" this was the Lumira reply.


It does not work.


rgds,

Shefif