Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

If Row Blank Use Other Value

Hi there!

 

I have 2 tables of cats. I would like to create a sum of cat amounts. The caveat is that when there is a value in the override table for a date, that value is summed instead of the value in the cats table. 

 

Ie  total cats amount = (4+4+4)+(1+2+3+4) = 22

Table Cats  
DateCat AmountCat Cost
6/30/2018432
7/1/2018434
7/2/2018444
7/3/2018322
7/4/2018635
7/5/2018221
7/6/2018445

 

Table Cat Override  
DateCat AmountCat Cost
7/3/2018113
7/4/2018222
7/5/2018333
7/6/2018466

 

  • Hi Anonymous

     

    You may try to create a measure as below:

    Measure =
    SUMX (
        'Cats',
        IF (
            RELATED ( 'Cat Override'[Date] ) <> BLANK (),
            RELATED ( 'Cat Override'[Cat Amount] ),
            Cats[Cat Amount]
        )
    )

    Regards,

    Cherie

1 Reply

  • v-cherch-msft's avatar
    v-cherch-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous

     

    You may try to create a measure as below:

    Measure =
    SUMX (
        'Cats',
        IF (
            RELATED ( 'Cat Override'[Date] ) <> BLANK (),
            RELATED ( 'Cat Override'[Cat Amount] ),
            Cats[Cat Amount]
        )
    )

    Regards,

    Cherie