Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Why this IF/SWITCH condition does not work?

Hello

 

I have a Table1 with an Index column:

1

2

3

etc

 

I create a calculated column with the following expression:

 

Column = SWITCH(Table1[Index],1,[AVG])
or
Column = IF(Table1[Index]=1,[AVG])
 
Where [AVG] is a measure:
AVG = AVERAGE(Table2[Column1)
 
However, none of these work. Any idea?
  • Two quick things to check - 1. is there a relationship between Table 1 and Table 2 (going from 1 to 2) on Index column?  2. Is one of your two Index columns the wrong data type (text vs. whole number)?

     

    If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Two quick things to check - 1. is there a relationship between Table 1 and Table 2 (going from 1 to 2) on Index column?  2. Is one of your two Index columns the wrong data type (text vs. whole number)?

     

    If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

    • Anonymous's avatar
      Anonymous
      Not applicable

      True, the data format was text when it should be number, thanks!