Forum Discussion

bideveloper555's avatar
5 years ago
Solved

YOY on card

hi i want to exlcude records from YOY measure if there is no value for current year/month based on user slicer selection.   I did write a measure,which was working as it supposed to but requiremen...
  • MFelix's avatar
    5 years ago

    Hi bideveloper555 ,

     

    Create the following measures:

     

    Previous year = 
    SUMX (
        VALUES ( 'Table'[Id] ),
        IF (
            ISBLANK ( SUM ( 'Table'[ Current YEAr ] ) ),
            BLANK (),
            CALCULATE (
                SUM ( 'Table'[ Current YEAr ] ),
                SAMEPERIODLASTYEAR ( 'Date'[Date] )
            )
        )
    )
    
    
    YOY % = DIVIDE([Previous year] - SUM('Table'[ Current YEAr ]) ,[Previous year])

     

    Now you can use on a table or a card:

     

    Believe that on your image some calculationa are not exactly at line level, but the syntax should be similar to the ones above.