Forum Discussion
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
😅
| red | like |
| green | dont like |
| blue | dont like |
- Anonymous4 years ago
HI campelliann,
>>why Power BI does not allow us to even mention a column in measures, without having a function around (max, values etc)
This should be related to the basic processing mechanism of measure expression, you can take a look at the following links to know more about them: (difference between a measure and calculated column, DAX row contents)
Calculated Columns and Measures in DAX - SQLBI
Row Context and Filter Context in DAX - SQLBI
Regards,
Xiaoxin Sheng
3 Replies
- amitchandak
Super User
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
Post 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!- AnonymousNot applicable
HI campelliann,
>>why Power BI does not allow us to even mention a column in measures, without having a function around (max, values etc)
This should be related to the basic processing mechanism of measure expression, you can take a look at the following links to know more about them: (difference between a measure and calculated column, DAX row contents)
Calculated Columns and Measures in DAX - SQLBI
Row Context and Filter Context in DAX - SQLBI
Regards,
Xiaoxin Sheng