Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

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

3 ACCEPTED SOLUTIONS

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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

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)] )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

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

View solution in original post

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

First, sample data would help tremendously. 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

 

That being said, I do not understand why you need a between date range, your formula looks like you just want a particular date, August 1st, 2018.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
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.

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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Sadly, I am getting the following error message:

 

Too few arguments were passed to the DATE function. The minimum argument count for the function is 3.

 

I have changed the / to , but that doesn't work.  If I change the month from 8 to 08 - it returns the same error.  Any thoughts?

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)] )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you for all of the help, Greg.  I am still getting errors, but I have ordered some books to read over the weekend.

 

Respectfully,

 

J Morningstar

Anonymous
Not applicable

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.