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
moutinhoabreu
Frequent Visitor

DATEDIFF, calculate days between today and SQL date field, error

Hi All,

 

I had a new column with the DATEDIFF working fine and suddendly stoped working.

 

Age = DATEDIFF(utcnow()+ 'Contas correntes de clientes'[dataven]+ DAY)

 

I was calculating the number of days between today and a sql column date with a previous date.

 

Now i have this error:

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

1 ACCEPTED SOLUTION

Seems like this should be the one:

 

Age = DATEDIFF(UTCTODAY(), 'Contas correntes de clientes'[dataven], DAY)

 

Is this a column or a measure?

 

This is what worked for me in a standard Calendar table:

 

Column = DATEDIFF(UTCTODAY(), [Date], DAY)

 


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

It seems like you have plus symbols (+) where you should have commas (,) or semi-colons (;). 

 

I am unaware of a regional language variation that uses + symbols like that...


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

I've tried with this both syntax:

 

Age = DATEDIFF(UTCTODAY(); 'Contas correntes de clientes'[dataven]; DAY)

 

and 

 

Age = DATEDIFF(UTCTODAY(), 'Contas correntes de clientes'[dataven], DAY)

 

And the error now is:

 

The syntax for ';' is incorrect. (DAX(DATEDIFF(UTCTODAY(); 'Contas correntes de clientes'[dataven]; DAY))).

Seems like this should be the one:

 

Age = DATEDIFF(UTCTODAY(), 'Contas correntes de clientes'[dataven], DAY)

 

Is this a column or a measure?

 

This is what worked for me in a standard Calendar table:

 

Column = DATEDIFF(UTCTODAY(), [Date], DAY)

 


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

It’s a column. I was aware of that limitation in measures.
Could it be possible due a direct query limitation on last power bi update ?
Since it was working before

Anyway you’re using DATE field without quotations and on my side when I select a sql field automatically places inside quotation ‘ xxxx ‘

@moutinhoabreu The single quotes in your expression is because of Spaces in your table name. It's no harm having single-quotes even if you don't have spaces in your tablename.




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

Proud to be a PBI Community Champion




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.