Search code examples
powerbipowerquerympowerbi-desktop

Power BI: Modify table via custom function


In Power BI, can a table be modified via an M function?

I have tried manipulating the table via Table.DeleteRows, Table.InsertRows etc. but the underlying table is not modified.

My idea:

Table

  • Contains OAuth2 authentication details

Function

  • Validates the current authentication details
  • If authentication details have expired, new authentication details are retrieved via an API call
  • New authentication details should then be stored in the Table

The above setup is designed to allow other API requests to use the same authentication details.


Solution

  • If you're asking if Power BI can modify the source data (e.g. a SQL database table), then no, it is not designed to do that. It's possible to do so indirectly by calling stored procedures that modify the source tables, but the Power BI query editor is intended to be read-only with respect to the original source.