title: Is there a function in R or Python that can calculate the share % of a multi-select Tableau filter individually?
body: <p>Looking to calculate the share % of multiple values selected in a filter individually without aggregating them together. </p>
  
  <p>This is going to be utilized in Tableau where the user opens the dashboard and selects items in a filter (n).  The (n) items each need their share % calculated and then added together in a later step.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>State Sales = SUM({FIXED [State],[Sub-Category] : SUM([Sales])})
  
  State Total Sales = SUM({FIXED [Sub-Category] : SUM([Sales])})
  
  Share % = State Sales / State Total Sales
  </code></pre>