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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Too many arguments were passed to the AND function. The maximum argument count for the function is 2

Hi,

 

Can anyone help. I'm trying to get this formula to run and I keep getting this error message:

 

Too many arguments were passed to the DATESBETWEEN function. The maximum argument count for the function is 3.

 

The formula is:

c_ARGB = IF([ARG A]="",0,
IF([ARG D]="",CALCULATE(SUM(DateTable[WORKDAY]),DATESBETWEEN(DateTable[Date],'IC CMS List'[ARG A],TODAY(),CALCULATE(SUM(DateTable[WORKDAY]),DATESBETWEEN(DateTable[Date],'IC CMS List'[ARG A],'IC CMS List'[ARG D]))))))

 

Thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

I believe you want:

 

c_ARGB = 
IF(
	[ARG A]="",
	0,
	IF(
		[ARG D]="",
		CALCULATE(
			SUM(DateTable[WORKDAY]),
			DATESBETWEEN(
				DateTable[Date],
				'IC CMS List'[ARG A],
				TODAY()
			)
		),
		CALCULATE(
			SUM(DateTable[WORKDAY]),
			DATESBETWEEN(
				DateTable[Date],
				'IC CMS List'[ARG A],
				'IC CMS List'[ARG D]
			)
		)
	)
)

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

I believe you want:

 

c_ARGB = 
IF(
	[ARG A]="",
	0,
	IF(
		[ARG D]="",
		CALCULATE(
			SUM(DateTable[WORKDAY]),
			DATESBETWEEN(
				DateTable[Date],
				'IC CMS List'[ARG A],
				TODAY()
			)
		),
		CALCULATE(
			SUM(DateTable[WORKDAY]),
			DATESBETWEEN(
				DateTable[Date],
				'IC CMS List'[ARG A],
				'IC CMS List'[ARG D]
			)
		)
	)
)

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

OMG Greg, Thank you!!! I've been banging my head against a wall regarding this solution for a month now. 

 

I noticed that in my original formula everything was on the same line. However, I cannot find out where to go so that I can enter the forumla on separate lines. The area that I insert my formulas doesn't allow me to enter formulas on seperate lines.

 

As a result, I tried to modify my formula to match yours but still on one line and I still got an error message. 

 

What was I doing wrong? and where can I go to practice so that I can get better? 

 

Alt-Enter is your friend. That sends you to a new line within the DAX editing window. Or you can just copy and paste my formula.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks. I utilized the copy and paste keyboard shortcut and copied your solution. I'm still amazed. Again thanks.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.