Show DAX Statements in Power BI

Show DAX for Measures and Calculated Columns

NOTE: This method works for both imported and DirectQuery storage of tables in the semantic model.

Calculated Columns

  1. Open Model View
  2. Select a calculated column, its DAX is displayed on the panel above

Measures

  1. Open Model View
  2. Select a measure, its DAX is displayed on the panel above

Show DAX for a Column in the Semantic Model in ‘DAX Query View’

  1. Open DAX query view
  2. Access Data > Model
  3. Right-click on a column, select [Quick queries]
  4. [Show data preview]
    • This will show DAX for that column and sample results.

Show DAX for a Specific Visualization Using Dax Studio

IMPORTANT: You need to run DAX studio as an administrator, or you may get errors about ‘CollectionView does not support changes’.

1. Launch DAX Studio as Administrator

  1. Right-click on the DAX Studio icon
  2. [Run as administrator]

2. Connect to Power BI Data Model

NOTE: If the pop-up window does not appear, click File in the upper-left corner > New.

  1. Power BI / SSDT Model: Select your Power BI report from the dropdown
  2. [Connect]

3. Set Up Query Recording

Access Home tab

  1. [All Queries]
    • The button should appear pressed/highlighted to indicate active recording
  2. Switch to Power BI Desktop report window:
    • Interact with various visuals,
    • Click different filters,
    • Navigate between pages.

NOTE: Every interaction will generate queries that are captured in DAX Studio.

4. View Recorded Queries

Return to DAX Studio

  1. Open All Queries to view the recorded queries
  2. You'll see all executed queries in the query window, each query will show:
    • The DAX code,
    • Execution time,
    • Server timing details.
  3. Click [All Queries] again to toggle off recording
  4. Click [Clear] to remove existing queries and start fresh