Forum Discussion

rohitjmd's avatar
rohitjmd
Helper II
7 years ago
Solved

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.

 

ProductTypeObservation
A1Good 
A3Bad 
A2Good 
B2Good 
B1Good 
C1Bad 
C2Good 
C3Worst 
D1Good 
    
    
    
ProductTypeObservationInconsideration
A1GoodNo
A3BadNo
A2GoodNo
B2GoodYes
B1GoodYes
C1BadNo
C2GoodNo
C3WorstNo
D1GoodYes
  • 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

  • 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"
    )
    • parry2k's avatar
      parry2k
      Super User

      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" )