Forum Discussion

snandy2011's avatar
snandy2011
Helper IV
7 years ago
Solved

if statement not working properly

Hi all,   Please consider below situation,   I have one date table and i have two companies datasets as two tables.   Lets Say, company A and company B so, company A data look like date      ...
  • v-lili6-msft's avatar
    7 years ago

    HI, snandy2011

    You need to use "all" Functions in your formula:

    IF (
        VALUES ( 'Date Table'[MonthName] ) = "March",
        CALCULATE (
            [total session],
            FILTER ( ALL ( 'Date Table' ), 'Date Table'[MonthName] = "May" )
        ),
        IF (
            VALUES ( 'Date Table'[MonthName] ) = "April",
            CALCULATE (
                [total session],
                FILTER ( ALL ( 'Date Table' ), 'Date Table'[MonthName] = "June" )
            )
        )
    )

    Best Regards,

    Lin