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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
DNA
Frequent Visitor

Dax Statement: The end of the input was reached

I am attempting to create an IF dax statement that will have about 5 conditions to it and it's comparing information between dates. I have tried entering the statement and i get the following message in the error message "The end of the input was reached" and it highlights in red the last couple of words in my statement.


What does the error "The end of the input was reached" mean? Do DAX statement have a specified length?

1 ACCEPTED SOLUTION

Hi @DNA,

 

Please try the DAX below.

Age Group = 
If([borrower dob] >= Date(1930,1,1) && [borrower dob] <= Date(1945,12,31),"Silent Generation",
If([borrower dob] >= Date(1946,1,1) && [borrower dob] <= Date(1964,12,31),"Baby Boomer", 
If ([borrower dob] >= Date(1965,1,1) && [borrower dob] <= Date(1981,12,31),"Gen X","Millennials")))

Capture.PNG

 

 

Regards,

Charlie Liao

View solution in original post

9 REPLIES 9
alifazal
Helper I
Helper I

New Table =
FILTER (
'VINITMB',
'VINITMB'[IFLOC] = "2005"
&& CALCULATE ( SUM( ( [Over Stock]] ) < 0 )
)))))))))))))))))))

Take out the second square bracket after the Over Stock column. That was the error

DNA
Frequent Visitor

Bumping this - I'm a new poster and i don't think this got posted until email was verified. 

KHorseman
Community Champion
Community Champion

It most likely means you're either missing a close parenthesis or you have too many, or some other punctuation mistake. But it's hard to troubleshoot a formula if you don't post it so we can see.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DNA
Frequent Visitor

This is what I'm trying to do

 

I have a column in my table called Borrower Date of Birth in date format for each row

 

I am trying to create a new column called "Age Group" and use Borrower Date of Birth to create a Dax statement to populate the fields based on my formula. I am trying to create the following age groupings:  

 

"Silent Generation" - if you are born between 1/1/1930 and 12/31/1945

"Baby Boomer" - if you are born between 1/1/1946 and 12/31/1964

"Gen X" - if you are born between 1/1/1965 and 12/31/1981

"Millennials" - if you are born after 1/1/1982

 

Below was my statement and received the message "The end of the input was reached"

 

If([borrower dob] >= Date(1930,1,1) && {borrower dob} <= Date(1945,12,31),”Silent Generation”, If({borrower dob} >= Date(1946,1,1) && {borrower dob} <= Date(1964,12,31),”Baby Boomer”. If ({borrower dob} >= Date(1965,1,1) && {borrower dob) <= Date(1981,12,31),”Gen X”, If([Borrower DOB] >= DATE(1982|1|1)|"Millennials")

Hi @DNA,

 

Please try the DAX below.

Age Group = 
If([borrower dob] >= Date(1930,1,1) && [borrower dob] <= Date(1945,12,31),"Silent Generation",
If([borrower dob] >= Date(1946,1,1) && [borrower dob] <= Date(1964,12,31),"Baby Boomer", 
If ([borrower dob] >= Date(1965,1,1) && [borrower dob] <= Date(1981,12,31),"Gen X","Millennials")))

Capture.PNG

 

 

Regards,

Charlie Liao

Take out the second square bracket after the Over Stock column. That was the error

Thanks Charlie, that seemed to work. It looks like my statement needed to be fixed to have a third argument

KHorseman
Community Champion
Community Champion

You have all kinds of syntax mistakes in there. You're using {curly brackets} where you should be using [square brackets], you have open {curly brackets without a close at the end, open {curly brackets closed by a square bracket], you have a period in place of a comma, you're using paired quotation marks instead of neutral, you're using pipe characters | instead of commas, and you're missing two close parentheses )) at the end. On top of all that, your last IF statement only has 2 arguments when it requires 3.

 

You need to space out and format your code so it's easier for you to find mistakes.

 

IF(
	[Borrower DOB] >= Date(1930, 1, 1) && [Borrower DOB] <= Date(1945, 12, 31),
	"Silent Generation",
	IF(
		[Borrower DOB] >= Date(1946, 1, 1) && [Borrower DOB] <= Date(1964, 12, 31),
		"Baby Boomer",
		IF([Borrower DOB] >= Date(1965, 1, 1) && [Borrower DOB]) <= Date(1981, 12, 31),
		"Gen X",
		IF(
			[Borrower DOB] >= DATE(1982, 1, 1),
			"Millennials",
			YOU'RE MISSING SOMETHING HERE. AN IF STATEMENT REQUIRES 3 ARGUMENTS.
		)
	)
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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