| Aliasing Columns in DAX |
| Written by Chris Webb | |||
| Friday, 13 January 2012 02:37 | |||
|
Reposted from Chris Webb's blog with the author's permission. Creating a copy of a column with a new name is pretty simple in DAX: you can just use the AddColumns() function. For example if we take a model with the DimProductCategory table from Adventure Works in, we could create a copy of the EnglishProductCategoryName column like so: evaluate However, in some calculations and queries I’ve been playing around with, this isn’t enough: I’ve not only needed to create a copy of the column but also to remove the original. So for example to crossjoin the DimProductCategory table with itself and get a cartesian product of all the possible combinations of Category name you can’t just do this: evaluate Because you’ll get the following error: Function CROSSJOIN does not allow two columns with the same name ‘DimProductCategory’[EnglishProductCategoryName]. What you need to do is add the new column with AddColumns() and then use Summarize() to get a new table that only contains the values in this new column, like so: evaluate
|
Author articles
- Controlling the Position of Subtotals in DAX with GenerateAll()
- Self-Service BI Mapping with Microsoft Research’s Layerscape–Part 2
- Self-Service BI Mapping with Microsoft Research’s Layerscape–Part 1
- Aliasing Columns in DAX
- Using Google Docs, Data Explorer and PowerPivot for Questionnaires
Most Popular
- Step by step guide on installing PowerPivot for SharePoint on a single machine
- List of suggested datasets to test PowerPivot
- List of PowerPivot DAX functions with description
- How to install PowerPivot for Excel and list of know issues
- Microsoft Virtual Lab: PowerPivot for Excel 2010 Introduction
- List of PowerPivot DAX functions (short)
- Learning PowerPivot and DAX
- PowerPivot's impact on BI pros?



