Forum Discussion

MRN8840's avatar
MRN8840
Helper I
6 years ago
Solved

Percent difference in visuals

Hi!   I have a page looking like this:     In the top and bottom section I can choose a week ('Uge i år') in a year ('År') and compare the consumption of electricity, water and heat.   H...
  • v-lili6-msft's avatar
    6 years ago

    hi  MRN8840 

    For your case, you'd better use this logic to create a last year measure to get it:

    Last year = CALCULATE(SUM('Table'[electricity]),FILTER(ALL('Date'[Year]),'Date'[Year]=MAX('Table'[Year])-1))
    Percent L/C = DIVIDE([Last year],CALCULATE(SUM('Table'[electricity])),0)

    Result:

    here is sample pbix file, please try it.

     

    By the way, for the next year measure, you could try this logic:

    Next year = CALCULATE(SUM('Table'[electricity]),FILTER(ALL('Date'[Year]),'Date'[Year]=MAX('Table'[Year])+1))

     

    Regards,

    Lin