Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

compare results

Hello All, i have been working on as task and finally decided to ask it here as this forum has been very helpful to me lately.            Is there a way in PowerBI to compare the results of previous...
  • v-juanli-msft's avatar
    v-juanli-msft
    7 years ago

    Hi Anonymous 

    Create two new table

    calendar1 = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))
    
    calendar2 = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))

    Create relationships as below

     

    Create measures in Sheet2

    sales = SUM(Sheet2[value])
    
    previous sales = CALCULATE([sales],ALL(calendar1),USERELATIONSHIP(calendar1[Date],calendar2[Date]))
    
    difference = [sales]-[previous sales]

    Best Regards
    Maggie

     

    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.