Power BI supports extensive Data Analysis Expressions(DAX) scripting to achieve complex business scenarios. It is a good practice to maintain a document for each report which helps in future development. The Document can include screenshots of Report Pages, Purpose of the Report, Lists of Navigation, Tables and Queries and a complete listing of the DAX formulas.

All this information is easily achievable except for the DAX formulas. Using DAX users can create Measures and Columns in PowerBI.  However, there is no direct option to export the DAX formulas for documentation purposes. This blog will cover exporting the Measure and Column definitions into a CSV file from Power BI.

Steps to export the DAX formulas

1.  Navigate to Model View.exporting-measure-column-formulas-power-bi

2. Click File Menu -> Export as Power BI Template.
exporting-measure-column-formulas-power-bi

3. Exported PowerBI template will have the extension .pbit. Open the PowerBI template file as RAR file.
exporting-measure-column-formulas-power-bi

 

4. List of files in PowerBI template.exporting-measure-column-formulas-power-bi

5. Click and Open DataModelSchema in any JSON editor.There are plenty of JSON editor available  online.  You can access the below link to use the same JSONeditor used here in this blog.
https://jsoneditoronline.org/

6. Generally, JSON  is represented as a Key Value Pair. You can Navigate to the Key Value Pair of tables which will list all the  tables used in the PowerBI report.
E.g.: In the below highlighted section we use the Key as tables and Value within the set bracket[]exporting-measure-column-formulas-power-bi

 

7. For each key value pairs inside tables key have following structure. Columns and Measures created in PowerBI will have separate key value pair. Here we have just highlighted the Measure Key Value Pair.
exporting-measure-column-formulas-power-bi

 

8. After expanding the Measure key, we can get the value of each Measures. Here the value as DAX formula.exporting-measure-column-formulas-power-bi

9. Copy the value of the Key Measure.
exporting-measure-column-formulas-power-bi

10.  Paste the copied Value of the Key Measure in any of the JSON to CSV editor. You can refer this website to learn more. https://json-csv.com/

11. CSV File will have the following structure. This is the based Value of the Key MeasureIt may differ for the Key Value Pair of Column.exporting-measure-column-formulas-power-bi

 

By this we have achieved exporting Measure and Column formulas from Power BI to a CSV File.

 

Know more about Microsoft Power BI services offerings from Visual BI solutions here.

 

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com