cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAC for Planning - DATEDIFF with variable-member or integer, how to?

Deb_D
Participant
0 Kudos
450

Hello, 
I need to find out the difference between to dates. However these dates are not properties but actual income and outgoing transactions.

I separated them into 3 measures (income outgoing and difference), but I can't change these into accounts or create a generic dimension if that's the best practice. I have only one time dimension, also here I can create few time dimensions if that's the best practice.  let me know your thoughts.
 
in the below example the result I'm looking for is Jan 6th minus Jan 4th = 2 days 

Deb_D_0-1741072380951.png

I made several trials with INTEGER or VARIABLEMEMBER (like below) no one worked.
example of a failure:

VARIABLEMEMBER #INCOME OF [d/Date]
VARIABLEMEMBER #OUTCOME OF [d/Date]

FOREACH [d/IL_D_POC_RPD_STATUS]
    IF RESULTLOOKUP([d/Measures]="Income", [d/IL_D_POC_RPD_STATUS]="STS_023") > 0 THEN
       DATA([d/Measures]="Income",[d/Date]=#INCOME)=RESULTLOOKUP()
    ENDIF
    IF RESULTLOOKUP([d/Measures]="Outgoing", [d/IL_D_POC_RPD_STATUS]="STS_023") > 0 THEN
       DATA([d/Measures]="Outgoing", [d/Date]=#OUTCOME)=RESULTLOOKUP()
    ENDIF
ENDFOR

DATA([d/Measures]="Time_deviation",[d/Date]="2025-01-01") = DATEDIFF(#INCOME, #OUTCOME, "DAY")

 

thanks!

 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

William_Yu1
Product and Topic Expert
Product and Topic Expert
0 Kudos
Simplest way is to have another date dimension.
Deb_D
Participant
0 Kudos
thank you
MKreitlein
Active Contributor
0 Kudos

Hello @Deb_D 

I'm no real Data Actions expert... but checking the SAC Help page I'm wondering a bit that your variables start with # instead are %Income% and %Outcome% ?

Example there: @DiffMonth = DATEDIFF(%EndDate%, TODAY(), "MONTH")

Maybe it helps? Otherwise you really need an expert here 😅

BR, Martin

Deb_D
Participant
0 Kudos
I will try, thank you @MKreitlein 😄