Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

DAX for between a date range Q

 would like to run my SUMX() with a FILTER() between a date range that I want hard coded. What I have doesn't work when I add in the between date range component. See code below:

 

EnquiryTest = SUMX ( FILTER ( '_enquiries,' '_enquiries'[_tsg_clientid_value] = 'accounts[accountid']) &&

'_enquiries'[Date] => {08/01/2018} &&

'_enquiries'[Date] =< {08/01/2018}, _enquiries[Amount (Enq)] )

 

What is the proper syntax for a between date range?

Thank you

  • It should be:

     

    EnquiryTest = SUMX ( FILTER ( '_enquiries,' '_enquiries'[_tsg_clientid_value] = 'accounts[accountid']) &&
    '_enquiries'[Date] => DATE(2018/8/1) &&
    '_enquiries'[Date] =< DATE(2018/8/31), _enquiries[Amount (Enq)] )

    But, would need sample data to be sure.

  • Shoot, sorry about that, I meant to use commas:

     

    EnquiryTest = SUMX ( FILTER ( '_enquiries,' '_enquiries'[_tsg_clientid_value] = 'accounts[accountid']) &&
    '_enquiries'[Date] => DATE(2018,8,1) &&
    '_enquiries'[Date] =< DATE(2018,8,31), _enquiries[Amount (Enq)] )
  • Anonymous's avatar
    Anonymous
    7 years ago

    EnqAmt =
    SUMX (
    FILTER ( _enquiries, _enquiries[_tsg_clientid_value] = accounts[accountid] && _enquiries[Date] >= DATE(2018,08,01) && _enquiries[Date] <= DATE(2018,08,31) ), _enquiries[Amount (Enq)]
    )

     

     

     

    #this_works

7 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      I am wanting a between dates filter.  I can't use the current month, because that won't work when the month changes.  I would like to see the hard coding of a between date range.  What would it look like with the beginning of August to the end of August.

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        It should be:

         

        EnquiryTest = SUMX ( FILTER ( '_enquiries,' '_enquiries'[_tsg_clientid_value] = 'accounts[accountid']) &&
        '_enquiries'[Date] => DATE(2018/8/1) &&
        '_enquiries'[Date] =< DATE(2018/8/31), _enquiries[Amount (Enq)] )

        But, would need sample data to be sure.