Forum Discussion

olaidaz's avatar
olaidaz
New Member
7 years ago
Solved

HOW TO CREATE DAY ON DAY VARIANCE

Hello, I am new to powerbi and I have been struggling to create a day-day week on week variance on particular products. below is snapshot. kindly assist.

 

 

 

  • Hi olaidaz

     

    As your original snapshot doesn't show the product purchase data, I use some sample data to create a desired column: 

     

    PercentageDiff = var pre=
    CALCULATE(DIVIDE(SUM('Table'[Sales]),CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Product]))),FILTER('Table','Table'[Product]=EARLIER('Table'[Product])&&'Table'[Date]=EARLIER('Table'[Date])-1))
    return DIVIDE('Table'[Sales],CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Product])))-pre
     

     

    Best Regards,
    Qiuyun Yu

3 Replies

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Community Support

    Hi olaidaz

     

    Would you please clarify the sentence "have been struggling to create a day-day week on week variance on particular products."? 

     

    As you already posted a snapshot of your sample data, please tell us your desired result based on the sample data. 

     

    Best Regards,
    Qiuyun Yu

  • Hi v-qiuyu-msft,

     

    Thanks for your response. I want to create a new column that will show daily percentage variance as products are purchased daily.

    • v-qiuyu-msft's avatar
      v-qiuyu-msft
      Community Support

      Hi olaidaz

       

      As your original snapshot doesn't show the product purchase data, I use some sample data to create a desired column: 

       

      PercentageDiff = var pre=
      CALCULATE(DIVIDE(SUM('Table'[Sales]),CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Product]))),FILTER('Table','Table'[Product]=EARLIER('Table'[Product])&&'Table'[Date]=EARLIER('Table'[Date])-1))
      return DIVIDE('Table'[Sales],CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Product])))-pre
       

       

      Best Regards,
      Qiuyun Yu