Forum Discussion

sraj's avatar
sraj
Icon for Responsive Resident rankResponsive Resident
5 years ago
Solved

Year & month comparision

Hi everyone, Is there anyway to show the difference between years?  Both Years/Months are in the same table, can someone please advise?    
  • v-xulin-mstf's avatar
    v-xulin-mstf
    5 years ago

    Hi sraj,

     

    You can try measure as:

    Measure = 
    IF(
        HASONEVALUE('Table'[Date]),
        MAX('Table'[Sales]),
        CALCULATE(
            MAX('Table'[Sales]),
            FILTER(
                'Table',
                YEAR('Table'[Date])=2021)
        )-
        CALCULATE(
            MAX('Table'[Sales]),
            FILTER(
                'Table',
                YEAR('Table'[Date])=2020)
        )
    )

    Here is the output:

    The pbix is attached.

     

    If you still have some question, please don't hesitate to let me known.‌‌

     

    Best Regards,

    Link

     

    Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!