Forum Discussion

campelliann's avatar
campelliann
Icon for Post Patron rankPost Patron
4 years ago
Solved

Theoretical explanation on the IN Values (Column)

Hi,


So I often do this, but I cant understand clearly the need.

If I had to write a measure on a table if I like/dislike a color I could simply write (if table[color]="red", "like", "dont like").

What I dont understand Is why on a matrix this would not work. I Know in a matrix there is a filter context, but I dont get why do I need to do something like If "red" IN values/distinct Table[color] , "like", "dont like". If there is a row with color red, then I am filtering the original table by color, and that should be enough to colapse the table to a single value.. sorry if this is stupid..

Many thanks 
😅

 

redlike
greendont like
bluedont like

3 Replies

  • campelliann , if this is measure it will like

     

    if( max(table[color])="red", "like", "dont like") and here we need color in context

     

    else create a new column

     

    if(table[color]="red", "like", "dont like")

    • campelliann's avatar
      campelliann
      Icon for Post Patron rankPost Patron

      amitchandak thank you for your reply (among others where you helped me). 

      My question is purely theoretical, why Power BI does not allow us to even mention a column in measures, without having a function around (max, values etc). Thanks!