Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Compounding values in a power BI measure

Hey everyone!   I have a question. I created a DAX measure, which divides two values, and gives me a percentage. This percentage changes every week. So far so good.  However what I want to achiev...
  • v-lili6-msft's avatar
    6 years ago

    hi Anonymous 

    For your case, you could try this way as below:

    Step1:

    Add an index column by yearweek column ([Year]*100+[WeekNum]) in date table.

    Index = RANKX('Date',('Date'[Year]*100+'Date'[Weeknum]),,ASC,Dense)

    Step2:

    Use this logic to get your requirement:

    Result =
     (
        CALCULATE (
            [Your percentage measure],
            FILTER ( ALL ( 'Date' ), 'Date'[Index] = MAX ( 'Date'[Index] ) - 1 )
        ) + [Your percentage measure]
    ) / 2

     

    By the way, the result should be 29: (-73.37) + (-72.26))/2= -73.315  Week 30: -40.81 and so on

    If not your case, please share your sample pbix file and expected output.

     

    Regards,

    Lin