Forum Discussion

luistiscornia's avatar
luistiscornia
Regular Visitor
5 years ago
Solved

biannual comparative

Hi! What formula can I apply to be able to compare the period 2019 with the period 2017 since with the measurement  CALCULATE([VOTOS TOTALES],SAMEPERIODLASTYEAR(Calendario[Año]=2017)) it throws me ...
  • v-kkf-msft's avatar
    5 years ago

    Hi luistiscornia ,

     

    The SAMEPERIODLASTYEAR function needs to reference a date/time column. You can try the following measure:

     

    comparativa = 
    CALCULATE(
        [VOTOS TOTALES], 
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Year] = MAXX(
                                FILTER(
                                    ALLSELECTED('Table'),
                                    'Table'[Year] < MAX('Table'[Year])
                                ),
                                'Table'[Year]
                            )
        )
    )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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