Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Switch function with If statement

Hello community,   I need your help with rewriting switch function with If statement. Below is my current code   Coke Goal = VAR _7D=MAX(table 1[DATE])-7 VAR _30D=MAX(table 1[DATE])-30 VAR _365D...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,

     

    Maybe you can try formula like below to create calculated column:

    Coke Value =
    SWITCH (
        TRUE (),
        'Table'[Days Open] < 365, 'Table'[Days Open] * 'Table'[Coke Goal],
        'Table'[Days Open] >= 365, 365 * 'Table'[Coke Goal]
    )
    

     

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.