Forum Discussion

sgsukumaran's avatar
sgsukumaran
Resolver II
8 years ago

Multiple calculate logic

I am trying to create calculate logic in if and else condition and it always turns blank. Any suggestions.



,IF( [Base]=2 ,(CALCULATE( [Sales] ,FILTER( ALL('Fiscal Calendar') ,'Fiscal Calendar'[LYRollingFiscalWeek]=1 ) )
,CALCULATE( [Sales] ,FILTER( ALL('Fiscal Calendar') ,'Fiscal Calendar'[LYRollingFiscalQuarter]=1 ) ) )

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sgsukumaran,

     

    I'd like some detailed information to clear your scenario.
    1. How did you use this formula? (calculate column or measure?)
    2. What does '[Base],[Sales]' mean? (measure of column?)

     

    Your formula seems well, I think blank result may due to filter conflict if [Sale] means measure and contain specific filter in it.

     

    You can also use below formula to check result of if statement.

    Result =
    IF (
        [Base] = 2,
        CALCULATE (
            [Sales]+1,
            FILTER ( ALL ( 'Fiscal Calendar' ), 'Fiscal Calendar'[LYRollingFiscalWeek] = 1 )
        ),
        CALCULATE (
            [Sales]+0,
            FILTER (
                ALL ( 'Fiscal Calendar' ),
                'Fiscal Calendar'[LYRollingFiscalQuarter] = 1
            )
        )
    )
    

     

    Regards,

    Xiaoxin Sheng