Search code examples
powerbidaxpowerbi-desktoppowerbi-custom-visuals

Need to calculate Percentage of product bought on every week based on week 1


Need to calculate Percentage of product bought on every week based on week 1.

week x % = Week X product bought / week 1 product bought

for example : week 2 % = 70/100, week 3 % = 50/100

but as soon as I introduce quarter other quarters are not calculating week 1 value and gives blank. Hence it goes

week 4 = 30/ blank.

DAX used =

 CALCULATE(
    DIVIDE(sum('Table'Product_bought),
    CALCULATE(sum('Table'Product_bought),  'Table'[weeks] =1))

enter image description here


Solution

  • Working now with the below Dax:

    CALCULATE( DIVIDE(sum('Table'Product_bought), CALCULATE(sum('Table'Product_bought), ALL('Table'Quarter), 'Table'[weeks] =1))