For Power BI, calculated table which is a Microsoft article explaining how to do this. It involves selecting new table under the modeling tab.
It is also possible to create DAX queries in excel for power pivot, though it is a less straight forward way. Also note that the DAX editor for doing the below is not the greatest.
To do this you would do the following:
Go to the data tab
Select existing connections
3.Click on the tables tab
- Select on of your table, a screen will pop up asking how to output select table and excel will create a table
5.Right click the table, in the drop down do table --> Edit DAX.
In the window that opened, change the command type in the drop down to DAX
Write your query. Hitting on will update the table to the results of your query.
Just keep in mind that this method is better when you already have your DAX query written.