title: How can I dynamically calculate a ratio based on a slicer?
body: <p>I have data from sales, aggregated by week of the year, and displayed by products.</p>
  <p>For each of the last 15 weeks, I want the ratio from the week-15. For example, at the <strong>week max 38</strong>, the <strong>week min is 23</strong>, so I want the ratio :</p>
  <p><code>([Sales Week 38]-[Sales Week 23])/[Sales Week 23]</code> for week 38</p>
  <p><code>([Sales Week 37]-[Sales Week 23])/[Sales Week 23]</code> for week 37</p>
  <p><code>([Sales Week 36]-[Sales Week 23])/[Sales Week 23]</code> for week 36, etc.</p>
  <p>Now, the line chart displays it fixed :</p>
  <p><a href="https://i.stack.imgur.com/6LzUZ.png" rel="nofollow noreferrer">Example fixed with week max 38 (so week min 23)</a></p>
  <p>At the week 23, the ratio is 0% because <code>([Sales Week 23]-[Sales Week 23])/[Sales Week 23] = 0</code>. And then, the ratio is correctly calculated with the number of sales week after week until the week 38.</p>
  <p>Instead of having the fixed <strong>week max = 38</strong>, I want to put a slicer to <strong>choose the max week</strong> that I want. For example if I put the slicer at week 35, I want to see the same graph with values from week 20 (0% because it will become the new start) to week 35.</p>
  <p>Thanks for your help !</p>