Forum Discussion

micmat's avatar
micmat
Regular Visitor
6 years ago
Solved

Ignore Value if no date

DateLocationProductValue
11/25/2019USA20
11/25/2019USB30
11/26/2019USA50
11/27/2019USA30
11/27/2019USB60

 

Hey all, so what I would like to do is have the chart show the value of Product B - Product A, but only if they both have a given date. So:

11/25/2019 : 10

11/26/2019: Show nothing (no line) since there is no product B for that date

11/27/2019: 30

 

I tried using some NOT(ISBLANK()) logic but it made my charts look off and not the correct results. Thanks for any help!

  • micmat I did with following measures

     

    Total Value = SUM ( 'Table (2)'[Value] )
    
    Product A Value = CALCULATE ( [Total Value], 'Table (2)'[Product] = "A" )
    
    Product B Value = CALCULATE ( [Total Value], 'Table (2)'[Product] = "B" )
    
    Product B - Product A = 
    IF ( [Product A Value] = BLANK() || [Product B Value] == BLANK(), BLANK(), [Product B Value] - [Product A Value]
    )

     

    Use bar chat, drop date on X-Axis and Product B - Product A on value section

4 Replies

    • parry2k's avatar
      parry2k
      Icon for Super User rankSuper User

      micmat I did with following measures

       

      Total Value = SUM ( 'Table (2)'[Value] )
      
      Product A Value = CALCULATE ( [Total Value], 'Table (2)'[Product] = "A" )
      
      Product B Value = CALCULATE ( [Total Value], 'Table (2)'[Product] = "B" )
      
      Product B - Product A = 
      IF ( [Product A Value] = BLANK() || [Product B Value] == BLANK(), BLANK(), [Product B Value] - [Product A Value]
      )

       

      Use bar chat, drop date on X-Axis and Product B - Product A on value section

    • micmat's avatar
      micmat
      Regular Visitor

      That is exactly it! How were you able to do it?