However, the most common way of using it is to use it inside a measure. You can use AddColumns to create a calculated table (such as the examples above, or creating a date table using DAX).
How to add columns in an excel query table code#
The code above adds two columns to the DimCustomer table AddColumns used to add more than one column AddColumns in virtual tables You can use the AddColumns to add more than one column, like below ADDCOLUMNS( The above expression can be written as a new table in Power BI AddColumn DAX function in Power BI The code above adds a new column to the DimCustomer, named “Total revenue from the customer”, and the expression for this new calculated column is the CALCULATE part of the expression above.
Table: the table that we want to add columns to it.The signature of using this function is as below Tabular functions cannot be used directly in a measure, they have to be embedded inside other functions, or they can be used as a table expression. It means it returns a table, not a value.
AddColumns DAX Tabular FunctionĪddColumns is a tabular function in DAX. In this article and video, I’ll explain how you can use it to add calculated columns on the fly to the virtual tables in measures or directly in a table.
How to add columns in an excel query table how to#
How to use AddColumns DAX function in Power BIĪddColumns is a DAX function that is helpful often when writing calculations in Power BI.