Forum Discussion

mdrammeh's avatar
mdrammeh
Helper III
9 years ago
Solved

How to create a calculated field by date interval

I need help creating a calculated field in Power BI or Power Query for the following measures:

 

Projects Submitted 27 months prior to “Constructions start” date”

Projects Released 21 months prior to “Construction Year”( Construction Year is 3 years from today's date)

Projects Scheduled between 12-18 months prior to “Construction Year”

Scheduled 1 Year Prior to “Construction Start”

 

Assuming I have the above field names to complete my calculations. Keep in mind that I want o use networking days only  if possible. 

 


Thanks for all your help in advance. 

 

Mustaff

  • You can do sth very similar in DAX with DATEADD, e.g.

     

    DATEADD( TheData[Date], -27, MONTH )

     

     

    - however your overall scenario is not very clear (to me) - do you e.g. want to count projects?

     

    Frank

  • Baskar's avatar
    Baskar
    9 years ago

    Ya this formula should work in Power BI without any change dude.

     

    lets see my example .

     

    But u have to create  calculated column in table . see the picture 

     

     

     

     

     

    let me know if it is not helping u , i will help u , to reach your goal

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Can you provide some sample data and an explanation of "networking days"?

     

    • mdrammeh's avatar
      mdrammeh
      Helper III

      In Excel it would translate to something like this:

       

      =DATE(YEAR(B33),MONTH(B33)+27,DAY(B33))

      =DATE(YEAR(B33),MONTH(B33)-27,DAY(B33))

       

       

      I tried to copy and paste the example but it didn't work. I hope this helps.

       

      • BetterCallFrank's avatar
        BetterCallFrank
        Resolver IV

        You can do sth very similar in DAX with DATEADD, e.g.

         

        DATEADD( TheData[Date], -27, MONTH )

         

         

        - however your overall scenario is not very clear (to me) - do you e.g. want to count projects?

         

        Frank