Search code examples
daxpowerbi-desktop

Code actions not available in new DAX Query View


In the new DAX Query View preview feature, there is a cool workflow to Evaluate a measure, and if needed, add the measure DEFINE statement in the query through a Code Action (the light bulb in the picture below):

https://learn.microsoft.com/en-us/power-bi/transform-model/dax-query-view#measure-update-workflow enter image description here

If I follow this workflow, the Code Action is there and works.
enter image description here

But if I start from a DAX Query from the Performance Analyzer pane, there's no light bulb. If I press Ctrl+. to check for Code Actions, I get "No code actions available".
enter image description here

Is there any other way to trigger the Code Action? Any idea why this doesn't work? I'm hoping this is a bug to be fixed, because this is just too useful. I've tried editing the DAX from Performance Analyzer to simplify it, but I haven't found anything that enables the Code Action.


Solution

  • It looks like it will not have these options if you already have a DEFINE statement in the query.

    The easy workaround is to comment out or just delete the DEFINE at the top of the query
    enter image description here

    Then the Code Action is available:
    enter image description here

    And when selected will add a new DEFINE at the top:
    enter image description here