cancel
Showing results for 
Search instead for 
Did you mean: 

Dates comparison in sap analytics cloud

bosegsap
Participant

Friends

I am trying to compare 2 date dimensions to see the result value as "boolean" say True or False.

Context: say we have 2 date dimensions

1)Adate(MM-DD-YYYY)

2)Bdate(MM-DD-YYYY)

---------------------------------

Calculation/Comparision needed : If(Adate<=Bdate,"A" elsif Adate>Bdate then "B" else "NA")

Could you share your experiences...

Thanks-Bose

Accepted Solutions (1)

Accepted Solutions (1)

mfoeken
Active Contributor
0 Kudos

Hi Bose,

You could try something like this:

IF([Adate] <= [Bdate], 'A', IF([Adate] > [Bdate], 'B', 'NA' ) )

SAP Analytics Cloud supports creating nested IF statements.

In the screenshot, I have used a date field (which is actually a hierarchy) and selected day. But the logic is the same.

Kind regards,

Martijn van Foeken | Interdobs

bosegsap
Participant
0 Kudos

Hi Martijn

For my date objects (Adate and Bdate) at modelling level i did configure hierarchy to Year-Qtyr-Month-Day

even then i couldn't see "Adate.day" and "Bdate.day", Am i missing anything here?

Thx-Bose

bosegsap
Participant
0 Kudos

Hi Martijn

Thank you.

It's working but only limitation is If function returns only numeric values 0,1 but not Boolean(True/False)


Warm Regards

Bose

Answers (1)

Answers (1)

mfoeken
Active Contributor
0 Kudos

Hi Bose,

I created the example with the BestRun_Demo model. Can you compare the setup of the hierarchy in that model compared to your own to detect any differences?

Kind regards,

Martijn van Foeken | Interdobs