Forum Discussion
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])))-preBest Regards,
Qiuyun Yu
3 Replies
- v-qiuyu-msftCommunity Support
Hi olaidaz,
Would you please clarify the sentence "I 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 - olaidazNew Member
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-msftCommunity 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])))-preBest Regards,
Qiuyun Yu