Forum Discussion

ITManuel's avatar
ITManuel
Icon for Responsive Resident rankResponsive Resident
5 years ago
Solved

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.

 

 

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

 

 

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

 

Thanks in advance.

 

Best regards

  • 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.

     

    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!

     

3 Replies

    • ITManuel's avatar
      ITManuel
      Icon for Responsive Resident rankResponsive 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

  • v-xulin-mstf's avatar
    v-xulin-mstf
    Icon for Community Support rankCommunity 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.

     

    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!