Forum Discussion

JoachimSA's avatar
JoachimSA
Icon for Helper II rankHelper II
3 years ago
Solved

Test calculated column as query in smaller table with SELECTEDTABLE

Hi All,   I would really like to test some more complex calculated column in Dax Studio or Tabular Editor.   This calculated column depends on multiple other columns in the same table which is fa...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi JoachimSA 

    If you want to add a new column, you can only add the columns already in the current table, you can not add columns in another table, to add columns in other tables you need to use expressions such as sum(), calculate(), etc , please refer to the following link:

    How to use AddColumns function in DAX and Power BI - RADACAD

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi JoachimSA 

    Did you use "return", e.g

     

    VAR Playground = 
    CALCULATETABLE(
            SELECTCOLUMNS(
                'Projects',
                "Needed Info 1", 'Projects'[Needed Info 1],
                "Needed Info 2", 'Projects'[Needed Info 2],
                "Needed Info 3", 'Projects'[Needed Info 3],
                
            ),
            'Projects'[Owner] = "John",
            'Projects'[Source] = "BWH"
        )
    return 
    ADDCOLUMNS(
       Playground,
       "Test Calc Column",    [Needed Info 1])
    

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.