Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Dear Power BI Representative,
I am reviewing Chapter 14 of The Definitive Guide to DAX and in the 'Understanding data lineage' section I was running the following code in DAX Studio as directed. However for some reason the SelectOnlyC2 variable DAX is not able to find C2 even though variable AddC2 is recognized if one sets the RETURN to AddC2 for testing. The error I received was 'Query (18,34) Column 'C2' cannot be found or may not be used in this expression.' Why is DAX unable to find C2 for the SelectOnlyC2 variable? Your insight into this matter is much appreciated.
Thank you.
DEFINE
MEASURE Sales[Sales Amount] =
SUMX ( Sales, Sales[Quantity] * Sales[Net Price] )
EVALUATE
VAR NonBlueColors =
FILTER (
ALL ( 'Product'[Color] ),
'Product'[Color] <> "Blue"
)
VAR AddC2 =
ADDCOLUMNS (
NonBlueColors,
"[C2]", 'Product'[Color]
)
VAR SelectOnlyC2 =
SELECTCOLUMNS( AddC2, "C2",[C2])/*issue with this formula, DAX is not able to find C2.*/
VAR Result = ADDCOLUMNS ( SelectOnlyC2, "Sales Amount",[Sales Amount] )
RETURN Result
ORDER BY [C2]
Solved! Go to Solution.
Hi @lt79_Pax
you probably need
VAR AddC2 =
ADDCOLUMNS ( NonBlueColors, "C2", 'Product'[Color] )
instead of
VAR AddC2 =
ADDCOLUMNS ( NonBlueColors, "[C2]", 'Product'[Color] )
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @lt79_Pax
you probably need
VAR AddC2 =
ADDCOLUMNS ( NonBlueColors, "C2", 'Product'[Color] )
instead of
VAR AddC2 =
ADDCOLUMNS ( NonBlueColors, "[C2]", 'Product'[Color] )
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |