Forum Discussion

Sirlearnalot's avatar
Sirlearnalot
New Member
7 years ago
Solved

Line Chart: Conditional Formatting

Hi, I'm trying to visualise e.g.. sales for a product during a year with campaign periods. Say the product was on campaign in Q1 and Q3 and not Q2 and Q4, I would like to show this in a line chart...
  • v-piga-msft's avatar
    v-piga-msft
    7 years ago

    Hi Sirlearnalot,

     

    For your scenario, you should create the four measures below to achieve your desired output.

     

    Yes_P1 = CALCULATE(SELECTEDVALUE(Table1[Sales]),FILTER('Table1','Table1'[Campaign period]="Yes"&&'Table1'[Product]=1))
    
    Yes_P2 = CALCULATE(SELECTEDVALUE(Table1[Sales]),FILTER('Table1','Table1'[Campaign period]="Yes"&&'Table1'[Product]=2))
    
    No_P1 = CALCULATE(SELECTEDVALUE(Table1[Sales]),FILTER('Table1','Table1'[Campaign period]="No"&&'Table1'[Product]=1))
    
    No_P2 = CALCULATE(SELECTEDVALUE(Table1[Sales]),FILTER('Table1','Table1'[Campaign period]="No"&&'Table1'[Product]=2))

    Then you drag these measure to Values Field to create the line chart.

     

     

    In addition, you could refer to this attachment.

     

    Best Regards,

    Cherry