Forum Discussion

Shreesefwere's avatar
Shreesefwere
Helper IV
3 years ago

swith statement

HI Expert,

unable to use switch statement in 2 table in ssas cube

i have used the switch statement but it is not taking columns from more than one table

I created calculated colmun 

=SWITCH(('Table1'[col1]="Opportunity Owner"),'Table1[col2],'Table2'[col1])

4 Replies

  • Hello Shreesefwere ,

    Instead of providing just Table2[Col1] use LOOKUPVALUE function there and it will bring data from other table. Switch function dont have that ability to pull from different tables.

     

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

    • Shreesefwere's avatar
      Shreesefwere
      Helper IV

      Hi Expert,

      actually table1- dept ,empid

      table2 deptid,deptname  

      table3 emp id,empname

       switch statement used in 

      table1--->table3

      table1--->table2

       

      so using switch(table2,deptname=Central, table3.empaname)

      empname is value not coming

  • Anonymous's avatar
    Anonymous
    Not applicable

    actually table1- dept ,empid

    table2 deptid,deptname  

    table3 emp id,empname

     switch statement used in 

    table1--->table3

    table2--->table3

     

    so using switch(table2,deptname=Central, table3.empaname)

    else condition used lookupvalue and tried lookupvalue(table1.col2,table2.col1,table1.col1) so when join in central fact table then lookupvalue not working

     

    empname is value not coming