Forum Discussion

mp390988's avatar
mp390988
Icon for Post Partisan rankPost Partisan
5 hours ago
Solved

Direct Query

Hi Folks,

Been a while since I touched power bi so I am bit rusty with few of the important concepts.

I was looking at the different storage modes like import vs direct query.

As far as I recall I know direct query doesn’t give you the data view in power bi desktop so you can’t see your data which is normally the place where you can create a calculated column. Having said that, my thinking tells me you therefore cannot create a calculated column on a table that has direct query. But ChatGPT saying you can create a calculated column on a table that has direct query.

Does anyone know if this is true?

Thank you!

 

  • Yes, you can. In DirectQuery you won't see the Data view, but you can still right-click the table in the Data pane and pick New column.

     

    The catch is that it has to be a row-level expression that can be pushed down to the source, meaning it can only use other columns from the same row of that table, no aggregations. Functions that can't fold just won't show up in autocomplete.

     

    Docs: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-directquery-about

     

    Hope this helps!

    https://www.linkedin.com/in/richard-ampie-218a07247/

2 Replies

  • rampie's avatar
    rampie
    Icon for Kudo Commander rankKudo Commander

    Yes, you can. In DirectQuery you won't see the Data view, but you can still right-click the table in the Data pane and pick New column.

     

    The catch is that it has to be a row-level expression that can be pushed down to the source, meaning it can only use other columns from the same row of that table, no aggregations. Functions that can't fold just won't show up in autocomplete.

     

    Docs: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-directquery-about

     

    Hope this helps!

    https://www.linkedin.com/in/richard-ampie-218a07247/

  • Hello mp390988​,

    Yes, you can create calculated columns on DirectQuery tables in Power BI, but with certain restrictions. 

    The important limitation is that functions requiring complex filter context or table iteration, such as CALCULATE() and SUMX(), aren't supported in these calculated columns.

    For more complex calculations, I'd recommend creating the column directly in SQL or using a Power Query transformation that supports query folding. Microsoft's DirectQuery documentation explains the restrictions.