cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Highlighted
Super User IX
Super User IX

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

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!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




View solution in original post

5 REPLIES 5
Highlighted
Super User IX
Super User IX

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

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!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted
Frequent Visitor

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

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

Highlighted
Super User IX
Super User IX

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

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!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




View solution in original post

Highlighted
Frequent Visitor

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

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 ‘

Highlighted
Super User I
Super User I

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

@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 Super User!




Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors