Forum Discussion

gazzo1967's avatar
gazzo1967
Helper III
3 years ago

Help with validating my date formula

HI All
Can someone explain if my logic is sound or am i on the wrong track?
g_ACTIVITY_DATE_NextDue Is a date field (confirmed)

 

g_ACTIVITY_DATE_NextDue = IF(ORACLE_V3[ROLE] = "BA", DATEADD(ORACLE_V3[g_ACTIVITY_DATE - Copy], 24,MONTH), DATEADD(ORACLE_V3[g_ACTIVITY_DATE - Copy], 12,MONTH))

but i doesnt work 😞

Thanks
Gary

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    gazzo1967 Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • gazzo1967's avatar
      gazzo1967
      Helper III

      Greg_Deckler 
      Apologies πŸ™‚
      I will take your point πŸ™‚

       

      So this is what im trying to do.

      I am trying to add  24 months to ORACLE_V3[g_ACTIVITY_DATE - Copy] field which will then write to the g_ACTIVITY_DATE_NextDue field ,
      NOTE: only the row where the ORACLEV3_ROLE value is 'BA' 

      All the other rows the ORACLE_V3[g_ACTIVITY_DATE - Copy] field would only add on 12 months to g_ACTIVITY_DATE_NextDue field.

      I am using the following formula

      g_ACTIVITY_DATE_NextDue = IF(ORACLE_V3[ROLE] = "BA"DATEADD(ORACLE_V3[g_ACTIVITY_DATE - Copy], 24,MONTH), DATEADD(ORACLE_V3[g_ACTIVITY_DATE - Copy], 12,MONTH))

       


      here is the data/ expected outcome

      ORACLEV3_ROLEORACLE_V3[g_ACTIVITY_DATE - Copy]g_ACTIVITY_DATE_NextDue
      OUTCOME Expected
      ECO12/06/202212/06/2023
      FSG13/06/202213/06/2023
      BA17/06/202217/06/2024
      FBO15/06/202215/06/2023
      EDBA16/06/202216/06/2023
      L1 Water17/06/202217/06/2023