Forum Discussion
Writing Calculated Visualization Back to SQL Table
- 4 years ago
ninsights if you have published this on a SSAS server (pbi workspace for example), you can write a PQ where you query the same SSAS server and utilize the same DAX query that generates this viz and try to write back the results in a SQL table.
An example of SQL write back with PQ
let Source = Sql.Database("myserver", "newtest"), emailVal = "[email protected]", Custom1 = "INSERT INTO [newtest].[dbo].[Table_1] (Email) VALUES('" & emailVal & "')", Custom2 = Value.NativeQuery(Source, Custom1) in Custom2Something like this
let
Source = Sql.Database("myserver", "newtest"),
SSAS query = SSAS Q with DAX query,
Val = convert the SSAS query to SQL insert row,
Custom1 = "INSERT INTO [newtest].[dbo].[Table_1] (Email) VALUES('" & Val & "')", Custom2 = Value.NativeQuery(Source, Custom1)
in Custom2
Generally speaking, Power BI is only intended to read data, not to write data back to a source. There are always methods of exporting and importing data from one place to another but I wouldn't recommend attempting to do this if you can avoid it.