cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrslyfox Regular Visitor
Regular Visitor

Arithmetic overflow error converting expression to data type int.

Hello, 

SQL statement:

 

declare
@FromDate datetime,
@ToDate datetime,
@startdate AS DATETIME = GETDATE()
set @FromDate = DATEADD(MONTH, DATEDIFF(MONTH, 0, @startdate) , 0)
set @ToDate = DATEADD(SECOND, -1, DATEADD(MONTH, 1, DATEADD(MONTH, DATEDIFF(MONTH, 0, @startdate) , 0) ) )
exec pS_ST32_Machines_All 110, @FromDate,@ToDate
select * from Print_Machines_All where ReportId = 110

No issues with SSMS
but PowerBI return Arithmetic overflow error converting expression to data type int.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator v-sihou-msft
Moderator

Re: Arithmetic overflow error converting expression to data type int.

@mrslyfox

 

Can you open SQL Profilter to check statement that passed to SQL Server when executing your SQL Statement? It may have issue when parsing the SQL statement in Power Query Advanced Editor. 

 

Also I suggest you use query parameter instead of declaring variable in your statement. Please refer to a similar thread below:

 

https://community.powerbi.com/t5/Integrations-with-Files-and/parameters-to-SP-or-Sql-query/m-p/58337

 

Regards,

1 REPLY 1
Highlighted
Moderator v-sihou-msft
Moderator

Re: Arithmetic overflow error converting expression to data type int.

@mrslyfox

 

Can you open SQL Profilter to check statement that passed to SQL Server when executing your SQL Statement? It may have issue when parsing the SQL statement in Power Query Advanced Editor. 

 

Also I suggest you use query parameter instead of declaring variable in your statement. Please refer to a similar thread below:

 

https://community.powerbi.com/t5/Integrations-with-Files-and/parameters-to-SP-or-Sql-query/m-p/58337

 

Regards,

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 219 members 2,467 guests
Please welcome our newest community members: