Forum Discussion

techiebee's avatar
techiebee
Frequent Visitor
9 years ago

Specify custom month for DATESMTD function in DAX

Hello,

 

Can we mention any random month name in DATESMTD function for which we can calculate total sales?

 

Please suggest.

Thanks in Advance.

5 Replies

  • Baskar's avatar
    Baskar
    Resident Rockstar

     

    Ya we can add , Try like this it will help u i hope so,

     

     

    Measure  =   CALCULATE(Sum (Sales), DATESMTD(DATEADD(calender[Date],2,MONTH))))

     

    Try this, here i was added two more month in my Current date.

     

     

     

     

    • techiebee's avatar
      techiebee
      Frequent Visitor

      Thanks Baskar, for the example.

       

      Measure  =   CALCULATE(Sum (Sales), DATESMTD(DATEADD(calender[Date],2,MONTH))))

       

      But I need to mention any random month name. Here, we see that it is adding 2 months to the current month.

      And while calculation, I wouldn't be knowing the relevance i.e. how many months it is before or after current month.

       

      e.g. User selects May 2016 and that should be passed in the DAX to calculate total sales in May.

       

      Please suggest.

      • Baskar's avatar
        Baskar
        Resident Rockstar

        Cool dude,

         

         

        see basically dax work with your case only.

         

        If u select "MOnthname " in slicer it will show only may month sales know ?

         

        Calculate(Sum(Sales))