Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ITManuel
Responsive Resident
Responsive Resident

Addcolumns -- Referencing previously added column in calculate

Hi all,

 

I'm writing a query with Addcolumns and need the result of previously added columns for further columns. To achieve this I'm nesting Addcolumns to use column references of columns added in the previous Addcolumns. 

Please see example below.

 

Addcolumns 1.JPG

 

Now I would need to use a previously added column in a new column using calculate, but referencing the column in calculate does not work

Addcolumns 2.JPG

Addcolumns 3.JPG

 

 

Why can I reference the [C2] column in DIVIDE but not in CALCULATE?

 

Thanks in advance.

 

Best regards

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @ITManuel,

 

The '[C2]' column is a generated column in the virtual table, it was not generated when you referenced [C2] in the virtual table.
If you want to reference [C2], you need to create the metric to reference it after the calculation table is generated.

vxulinmstf_0-1627614230968.png

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @ITManuel,

 

The '[C2]' column is a generated column in the virtual table, it was not generated when you referenced [C2] in the virtual table.
If you want to reference [C2], you need to create the metric to reference it after the calculation table is generated.

vxulinmstf_0-1627614230968.png

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

CNENFRNL
Community Champion
Community Champion

Here's a former thread on this subject

Solved: DAX: Is it possible to refer to columns of a table... - Microsoft Power BI Community


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

ITManuel
Responsive Resident
Responsive Resident

Hi @CNENFRNL ,

 

thank you for linking the thread, I read it a few times, but can still not fully understand why I can reference the column in a function like "DIVIDE" but cannot reference it in "CALCULATE". 

 

Any further explanation and solution is much appreciated. 

 

Thanks

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.