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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
p_stathopoulos
Frequent Visitor

Column calculated from function stored in MySQL

I need to calculate/create a new column in a table.

Each row (will be) is the result from a function (currently stored in MySQL Database - the same i am connected to get the table)

Table SALES

ProductDateSales
p11/1/2000100
p11/4/2000210
p21/4/2000200

The new column let's name it COST and is calculated as: function (product, date) and return the cost (is a FIFO calculation)

How can i import/replicate on PowerBI ?

ProductDateSalesCost
p11/1/200010080
p11/4/2000210170
p21/4/2000200160

 

I tried to load the function, (ok so far)

Invoked and added to the QUERIES (so it show up to New column as function)

The preview looks fine, but when i hit close & apply to create the actual column the i get an error: 

[DataSource.Error] MySQL: Fatal error encountered during data read

 

The table is over 210.000 row, maybe is this the problem ?

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Possibly the error is generated by a row that is not included in the power query preview (1.000 rows).

Maybe you can check this, with a limited set of rows.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

7 REPLIES 7
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @p_stathopoulos 

 

could you post some screenshots from what you have done at Power Query?

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Ok,

The steps i took:

I load the function from Source / Recent source (i have some other tables loaded before)

I also test with parameters if is working right

q1.jpg

q2.jpg

 

q3.jpg

 

I add a new column on the table i want

 

q4.jpg

q5.jpg

 Everythinglook good so far.

Then i hit save & apply  and return to Power Bi Desktop and it start to load / calculate

 

After the end (i think) give me the error:

 

q6.jpg

 

 

mwegener
Most Valuable Professional
Most Valuable Professional

Possibly the error is generated by a row that is not included in the power query preview (1.000 rows).

Maybe you can check this, with a limited set of rows.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Is there a way to check it or a iferror function to avoid it?

As i see after "Close & Apply" it goes up to 100.000 + row and after that it gives me the error (i can't see in what line the error occured) 

I remove 44.000 rows and now there is no error.

Is there a way to trace it (so i can find the real cause) other than remove 10-20-30-40.000 row each time and wait for the calculations to end (and repeat to narow it down to a single row), to find in what row is the error ?

My problem is solved, but i din't find the cause. Maybe i try to delete fewer rows until i narrow it down to a couple of rows

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @p_stathopoulos ,

 

did you solve your problem?


If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors