Тёмный

Power BI - Write Data to SQL 

BI Elite
Подписаться 71 тыс.
Просмотров 61 тыс.
50% 1

UPDATED: See this video for a better technique to write back multiple rows: • BULK Write Back to SQL...
In this Power BI tutorial, learn how to write your data back to a SQL database! I will show you how to query a web API and then store the results in a SQL Server database which you can then report off of! You can even set up multiple datasets on scheduled refresh to push your data to SQL every hour or even every 30 minutes!
Elite Power BI Consulting:
bielite.com
To enroll in my introductory or advanced Power BI courses:
training.bielite.com/
Connect with me on Twitter!
/ powerbielite

Наука

Опубликовано:

 

10 фев 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 99   
@BIElite
@BIElite 2 года назад
UPDATED: See this video for a better technique to write back multiple rows: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-WgIhsF7kEjI.html
@MTUK1981
@MTUK1981 9 месяцев назад
Great info. Tried to look for a simple explanation of Power BI data to SQL Server and you've done it! Thanks 🙂
@user-hu7ov6fi9y
@user-hu7ov6fi9y 3 года назад
Hey Parker, thanks a lot for this video! Very informative.
@cristian.angyal
@cristian.angyal 4 года назад
WOOW! This is Pure Gold! Thanks for sharing ! I'm already thinking of at least two use-cases I have:)
@BIElite
@BIElite 4 года назад
Great to hear, Cristian! I'm looking for other datasets to use this for as well.
@thiagofraletti4220
@thiagofraletti4220 3 года назад
Amazing. This approach enable the usage of Power Query to one of the most useful cases of ETL. Thanks!
@BIElite
@BIElite 3 года назад
I agree! It's lightweight and free.
@vladimir.v.saveliev
@vladimir.v.saveliev 4 года назад
Thanks!!! It's amazing!
@louism.4980
@louism.4980 5 месяцев назад
This is fantastic, thank you! :)
@nehashahpatel1741
@nehashahpatel1741 3 года назад
What a mastermind trick Parker you show.. Millions Thanks
@dannyaguirre2309
@dannyaguirre2309 3 года назад
This is awesome !!! I just created process to read SharePoint Online Lists and sink the data to the SQL Data Warehouse. I did have to modify the code as I need to run an insert for each row however Text.Combine() was the unsung hero. Passing the sql scripts as one large text tuple set, with a group by transformation. Thanks for explaining this !!!
@MacPaulos
@MacPaulos 3 года назад
Hey Danny, I'm very interested in the steps you did for this. This is exactly what I'm trying to do now :). Thanks for letting me know it's possible
@kirisko3067
@kirisko3067 3 года назад
Very very helpful Thank you
@tenaciousdata9200
@tenaciousdata9200 4 года назад
This is a good one! Thank you Parker!
@BIElite
@BIElite 4 года назад
No problem! Thanks for the comment
@deniseyu9015
@deniseyu9015 Год назад
It's really cool and amazing! Excellent tips
@saadnageeb4633
@saadnageeb4633 Год назад
Wonderful, its a very helpful Idea, Thanks a lot
@HachiAdachi
@HachiAdachi 4 года назад
Ah-Mazing! 😲 Thank you, Parker!
@BIElite
@BIElite 4 года назад
Haha thanks Hachi!
@padreloco9733
@padreloco9733 4 года назад
Thanks for the video! Amazing. One quick question: I have created a dataflow in power bi. A colleague of mine needs this dataflow to feed its PIMS. Is there I way I can pass her this dataflow? Let's say like exporting this dataflow to MySQL? Your Idea will be much appreciated. Thanks.
@plgmgua
@plgmgua 4 года назад
this is crazy good!!! thanks alot!
@BIElite
@BIElite 4 года назад
No problem, Peter!
@novak2033
@novak2033 4 года назад
Amazing! Thanks a lot!
@BIElite
@BIElite 4 года назад
No problem Jasa!
@hoke73
@hoke73 3 года назад
Hi, this is great. is there a way to do the same against oracle database? I get error ORA-00933 while running several sql statements in one value.nativequery. thx in advance
@jorgeeduardomoltenimoreno3048
@jorgeeduardomoltenimoreno3048 4 года назад
Nice Tip Man! thanks
@BIElite
@BIElite 4 года назад
No problem Jorge!
@JackOfTrades12
@JackOfTrades12 4 года назад
I was literally trying to do this using workaround R script (which I'm not good at). I can't believe this is so easy.... Thank you for your video!
@BIElite
@BIElite 4 года назад
Good to hear, Jon! I've also tried with Python and R lol
@JackOfTrades12
@JackOfTrades12 4 года назад
@@BIElite have you found any performance difference?
@JonasArnout
@JonasArnout 4 года назад
Interesting! Why would you not use MS Flow for this?
@shashankjyothi7979
@shashankjyothi7979 2 года назад
Hi. Does anyone know if you can write to a SQL db from a power BI report that has been published to a workspace?
@rakeshnag70
@rakeshnag70 4 года назад
Can we use this approach with sap data sources ?
@tejasbrahmbatt5344
@tejasbrahmbatt5344 4 года назад
Hi Parker, How can I delete the current SQL Table before and then bulk insert all the data from Power Query ? Please help..!!
@yudhinugrahariyansyah9432
@yudhinugrahariyansyah9432 4 года назад
i have multiple row to insert , it can work with text combine the list , but i got error if the data has single quotation mark in the text. any advice ?
@rakeshpanigrahi577
@rakeshpanigrahi577 3 года назад
Thanks Sir
@mehulbhatia5469
@mehulbhatia5469 3 года назад
Is it possible to writeback dax measure to sql server?
@NikoSuomiUlkoilee
@NikoSuomiUlkoilee 4 года назад
Interesting!
@ducthinhvu2167
@ducthinhvu2167 2 года назад
how did you do it can you share with me , thank you
@michamuszynski6832
@michamuszynski6832 4 года назад
Hi! this is very useful solution. BTW which of the dataset is your source for the raport? As I know there is no possibility to use multiple datasets for one report.
@BIElite
@BIElite 4 года назад
Dzień dobry Michał! Not sure exactly what you mean in this question. Could you elaborate?
@michamuszynski6832
@michamuszynski6832 4 года назад
@@BIElite I have understood that you have build three datasets 'DataInsert No 1,2,3' to insert data into a data base. Is your report refreshed once per hour as well? How are you able to connect three datasets to one report.
@MuhammadBerki
@MuhammadBerki 4 года назад
Fantastic tip, thank you 🙂
@BIElite
@BIElite 4 года назад
No problem, Muhammad!
@majdyazigi8185
@majdyazigi8185 4 года назад
Great video, just a question : does this work with MS Access database
@BIElite
@BIElite 4 года назад
Not totally sure, but you might be able to test it fairly quickly!
@Rafian1924
@Rafian1924 3 года назад
Hi, How do we do it if we have 1000 rows in a dataset table.
@Bananathan25
@Bananathan25 3 года назад
Hi, thank you so much for this. I can get the query to run, however it only runs for the first row in my dataset. Do you know how to get the Native query to run for each row in the dataset?
@Bananathan25
@Bananathan25 3 года назад
In case anyone comes across this, I've got it: Instead of right clicking and drilling down on the column, add this line of M code after the AddSQLColumn part: SQL = Text.Combine(#"Added Custom"[SQL],"#(lf)")
@yoismelperez2744
@yoismelperez2744 2 года назад
Has anyone tried this and works in the Desktop but not in the service? I have an example that works fine in both sides but a new report I am working on is writing to SQL from the Desktop but not in the service, so just checking if we know of any limitations on doing this?
@kaushmat
@kaushmat 3 года назад
This is very useful. 😲 1 question. In this example, you are writing back the data as part of a scheduled refresh process. Can it be done in a non-scheduled manner (i.e., the user opens the dashboard at her own convenient time, and wants to write certain data back to SQL through Power BI). Is this possible?
@BIElite
@BIElite 3 года назад
Really interesting question. Yes, definitely. Don't set this up for scheduled refresh, and instead just refresh the dataset manually. If your end user doesn't have access to the workspace, you can leverage Power Automate to refresh the dataset via button click in your Power BI report.
@timvollman9017
@timvollman9017 3 года назад
Which statement actually pulls data from the API data source
@lohitmm
@lohitmm 3 года назад
can you share this Power Bi file please for reference?
@tommynguyen4253
@tommynguyen4253 4 года назад
Wow, this is very eyes-opening. I am wondering how we can insert multiple values at the same time? The drill down took only one row at a time.
@BIElite
@BIElite 4 года назад
Good point, Tommy. You can get around this by converting your SQL column to a list and then using the Text.Combine() function to concatenate all of your rows.
@brijendraydv
@brijendraydv 4 года назад
@@BIElite Hi,thanks for the tip but it throws me error after list that cannot convert list to type text when i want to insert more than one record.Is it possible to make to more clear how to insert more than 1 record,thanks
@noyraz
@noyraz 4 года назад
its will be great to know how can we insert to sql more than 1 row
@brijendraydv
@brijendraydv 4 года назад
@@noyraz indeed ,looking forward for it😉
@DreeKun
@DreeKun 4 года назад
I did it like this: let fxListGenerate = () => let Source = List.Generate( ()=> [Result= try fxRunSQL(0) otherwise null, x = 0], each [Result] null, each [Result = try fxRunSQL([x]+1) otherwise null, x =[x]+1], each [Result]), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandTableColumn(your column names), #"Removed Duplicates" = Table.Distinct(#"Expanded Column1", {primary key column}), in #"Removed Duplicates" fxRunSQL = (x as number) => let Source = Sql.Database(server name, database name), INSERT = Value.NativeQuery(Source, #"API Call and INSERT Data"{x}[Custom]) in INSERT in fxListGenerate Although it works, it isn't very efficient because it just selects all tables, combines them and then removes the duplicates. Now that I saw this, I'm going to try Parker's advice.
@gabrielkn
@gabrielkn 4 года назад
Interesting .. would this be adaptable for a medium size table to be written back to SQL?
@BIElite
@BIElite 4 года назад
I'm not sure how this performance would look with scale. I imagine someone can come up with some better SQL to check if the record already exists, and then this should work ok.
@gabrielkn
@gabrielkn 4 года назад
@@BIElite I was thinking more on a flush and fill technique, definitely something to try. Thank you!
@zacharydrake7925
@zacharydrake7925 2 года назад
Do you know how I can expand this to multiple rows on a tabel? Currently only getting 1 row to write when I need it to look through a number of rows.
@BIElite
@BIElite 2 года назад
Hi Zachary, see my latest video from today! It shows how to insert multiple records in a SQL db.
@Tegarcahya
@Tegarcahya 3 года назад
I'm using Oracle as a database and I get errors like this "Native queries aren't supported by this value." any suggestion?
@mediocrestuff2783
@mediocrestuff2783 2 года назад
Hey did you get any solution for this error?
@MTerkait
@MTerkait 4 года назад
Hello, and thanks for the video, but I'm looking to change a value in the table, give the user to privilege to click and modify the Value in the table, and updating it where it should reflect back to the SQL/Oracle Database.
@davidlang8101
@davidlang8101 4 года назад
I need this too, is there any way a user could do an entry, and to push this value back to the DB? Thanks.
@zxuan
@zxuan 3 года назад
This is great! However it only works in Import data mode
@aswin131
@aswin131 4 года назад
How to insert the values to sql database, if we have mutliple records to be inserted?
@BIElite
@BIElite 4 года назад
You would need to employ some logic to group the rows together instead of drilling down into the value like I do in the video.
@RahulNegiworld
@RahulNegiworld 4 года назад
When I'm using INSERT I'm getting error i.e. Expression.Error: We cannot convert a value of type Table to type Text. Could you please suggest correct solution? Thanks in advance!
@didijaba
@didijaba 4 года назад
I had same problem, you need to turn AddSQL column to list and then use Text.Combine with space as separator. After that it works. AddSQLColumn = Text.Combine(#"Changed Type"[AddSQLColumn]," ")
@samwong777
@samwong777 3 года назад
@@didijaba After the AddSQLColumn step, I turned my SQL Column into a list. So does the Text.Combine step come in after I turn the SQL Column into a list? And what text am I combining?
@didijaba
@didijaba 3 года назад
@@samwong777 #"Create SQL expression" = Table.AddColumn(#"Changed Type3", "AddSQLColumn", each "IF EXISTS (SELECT * FROM tblHops_SatnoOpterecenje WITH (UPDLOCK) WHERE tblHops_SatnoOpterecenje_ID = '" & [tblHops_SatnoOpterecenje_ID] & "')#(lf)SELECT * FROM tblHops_SatnoOpterecenje#(lf)ELSE INSERT INTO tblHops_SatnoOpterecenje (DatumOpterecenja,Sat,Plan_MWh_Per_h, Ostvarenje_MWh_Per_h, tblHops_SatnoOpterecenje_ID) VALUES ('" & [DatumOpterecenja] & "','" & [Sat] & "'," & [Plan_MWh_Per_h] & "," & [Ostvarenje_MWh_Per_h] & ", '" & [tblHops_SatnoOpterecenje_ID] & "')#(lf)SELECT * FROM tblHops_SatnoOpterecenje"), #"Changed Type of SQL expression column" = Table.TransformColumnTypes(#"Added Custom4", {{"Create SQL expression", type text}}), AddSQLColumn = Text.Combine(#"Changed Type5"[AddSQLColumn]," "), Source3 = Sql.Database("server.xxxxxxx,12314", "NameOfDB"), INSERT = if Text.Length(AddSQLColumn)> 1 then Value.NativeQuery(Source3, AddSQLColumn) else Table.TransformColumnTypes(#table({"A"},{{0}}), {{"A", type text}}) in INSERT
@jcmv007
@jcmv007 4 года назад
Hi Parker, awesome video tried it out but got stuck on the Drill Down part as the values are not changing for new records, was only able to insert the one record. How can I get it to work?
@Rafian1924
@Rafian1924 3 года назад
Yes, Same case goes with me.
@yoismelperez2744
@yoismelperez2744 3 года назад
Yes, same here. James, were you able to find out how to get around this?
@yoismelperez2744
@yoismelperez2744 3 года назад
@@Rafian1924 same here, were you able to find out how to get around this?
@jcmv007
@jcmv007 3 года назад
@@yoismelperez2744 nope I was not.
@yoismelperez2744
@yoismelperez2744 3 года назад
@@jcmv007 I just did. Need to use Result = Text.Combine(AddSQLColumn, " ") right after creating the list
@roxanarodriguez1828
@roxanarodriguez1828 3 года назад
Woa can be this done with sharepoint list? or excel?
@BIElite
@BIElite 3 года назад
Yes it can! Any data source will work.
@roxanarodriguez1828
@roxanarodriguez1828 3 года назад
@@BIElite Oh really? is it the same process? isn't it? thank you very much
@mikapeltokorpi7671
@mikapeltokorpi7671 4 года назад
Thanks for the video. BTW: That's true "How to lie with statistics" classic in the first pic (showing 1,3 M to ... 1,3 M views) 😂
@BIElite
@BIElite 4 года назад
Scale could have been better for sure!
@AdamSaxton
@AdamSaxton 4 года назад
Just want to call out to be very careful with doing any type of INSERT/UPDATE/etc... within Power Query. In the video he had a check to make sure to not insert if it already exists which is good. the statement can run one or more times - which could lead to problems. Be very very careful. 🙏
@BIElite
@BIElite 4 года назад
Hi Adam, thanks for the input. I tried to make this point clear in the video.
@ertf7777
@ertf7777 3 месяца назад
Will the source sata will get affected if we write insert/update in power query?
@amarnadhgunakala2901
@amarnadhgunakala2901 3 года назад
missed SQL double check
@user-yo2nb4ry7i
@user-yo2nb4ry7i 3 года назад
норм 🙈
@rubenbasco7554
@rubenbasco7554 Год назад
Like it, but looks so complicated...
@Crisicus_01
@Crisicus_01 3 года назад
This is awfully hacky for something you can do with a stored procedure and an SQL job.
@sonhuynhtien4744
@sonhuynhtien4744 2 года назад
how did you do it can you share with me , thank you
Далее
BULK Write Back to SQL from Power BI
11:40
Просмотров 31 тыс.
마시멜로우로 체감되는 요즘 물가
00:20
Просмотров 3,7 млн
Configuring Incremental Refresh in Power BI
16:01
Просмотров 80 тыс.
Power BI - Moving X-Axis (Easy)
11:24
Просмотров 21 тыс.
Easiest Way to Get Microsoft Forms Data in Power BI
7:56
Power BI - Write Data to Excel (On Multiple Tabs)
14:37
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Просмотров 1,5 млн