Forum Discussion

Saumyas's avatar
Saumyas
Regular Visitor
3 years ago
Solved

Month over year trend

Hi,  I want to show current FY months data trend with last FY average in a chart. To be shown like this FY 2021-22 April 22 May 22 June 22 July 22 August 22   Please post any solution for th...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Saumyas ,

    You may consider nesting a layer of IF() or SWITCH outside of the measure:

    Measure = 
    VAR _LEFT = LEFT(MAX('Date'[Column]),2)
    VAR _RESULT = IF(_LEFT="FY", AVERAGE('Table'[Value]),SUM('Table'[Value]))
    RETURN
    _RESULT

    or 

    Measure 2 = 
    VAR _LEFT = LEFT(MAX('Date'[Column]),2)
    VAR _RESULT = 
    SWITCH(
        _LEFT,
        "FY",AVERAGE('Table'[Value]),
        "Ma",SUM('Table'[Value]),
        "Ap",SUM('Table'[Value]),
        COUNT('Table'[Value2]
    )
    RETURN
    _RESULT

    Please rewrite the formula as needed.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data