Forum Discussion
rohitjmd
7 years agoHelper II
column dax formula
can anyone help me implementing below in power bi. i want to add a column "inconsideration" where value should be yes if all product type of the product received "good" feedback otherwise it should be no. output column example is below for reference.
| Product | Type | Observation | |
| A | 1 | Good | |
| A | 3 | Bad | |
| A | 2 | Good | |
| B | 2 | Good | |
| B | 1 | Good | |
| C | 1 | Bad | |
| C | 2 | Good | |
| C | 3 | Worst | |
| D | 1 | Good | |
| Product | Type | Observation | Inconsideration |
| A | 1 | Good | No |
| A | 3 | Bad | No |
| A | 2 | Good | No |
| B | 2 | Good | Yes |
| B | 1 | Good | Yes |
| C | 1 | Bad | No |
| C | 2 | Good | No |
| C | 3 | Worst | No |
| D | 1 | Good | Yes |
Try this in a calculated column. Substitute 'Table' for your actual table name:
Inconsideration = IF ( CALCULATE ( COUNT ( [Observation] ), 'Table'[Observation] = "Bad", FILTER ( 'Table', [Product] = EARLIER ( [Product] ) ) ) > 0, "No", "Yes" )rohitjmd or add this expression for calculated column
Inobservation = VAR __observation = CALCULATETABLE( VALUES( 'Product'[Observation] ), ALLEXCEPT( 'Product', 'Product'[Product] ) ) RETURN IF( "Bad" IN __observation, "No", "Yes" )
2 Replies
- hnguy71Super User
Try this in a calculated column. Substitute 'Table' for your actual table name:
Inconsideration = IF ( CALCULATE ( COUNT ( [Observation] ), 'Table'[Observation] = "Bad", FILTER ( 'Table', [Product] = EARLIER ( [Product] ) ) ) > 0, "No", "Yes" )