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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mrslyfox
Helper II
Helper II

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
v-sihou-msft
Microsoft Employee
Microsoft Employee

@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,

View solution in original post

2 REPLIES 2
ChristianGeiger
Frequent Visitor

Hallo,

 

i know this is old, bute maybe someone get along this thread.
in my case i had an issue with the source datatype. I divided a column with 1000 and when the sourc colum was a 'whole number' it worked.

When choosing a different columne the data was a 'whole number'(int) but the datatype was  'decimal' after changeing the datytype it worked.

v-sihou-msft
Microsoft Employee
Microsoft Employee

@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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.