3 Replies Latest reply: Nov 3, 2018 2:24 AM by Scott Allen RSS

    Date Range using formatting

    Scott Allen



      I am struggling with trying to write the correct formula for a date range in the current month.  If I write


      Sum({$<[Episode.NonAdmitDate]={">=2018-10-01 <=2018-10-31"}>}[Episode.IsNonAdmit])


      it works fine, but I want to automate the process so I don't have to adjust the timeline every month.  I'm sure I jacked up the syntax in this, and wondered if someone could give me a little nudge in the right direction.  This is what I am trying to do (and the date format in the field is YYYY-MM-DD):


      Sum({$<[Episode.NonAdmitDate]={'$(>=floor(Date(Monthstart(Today(),'YYYY-MM-DD'))) <=floor(Monthend(Date(Today(),'YYYY-MM-DD'))))'}>}[Episode.IsNonAdmit])


      I've tried using ' and " in the set, and I've tried to position the 'YYYY-MM-DD' in different places in the ()'s, but I just cant get it to work.


      Any suggestions?  Thanks in advance for your help!