powerbidax

How would you get category share across time in PBI?


I have a PBI table with 4 columns, date, category, weight and amount. I'm trying to make a measure to visualize the weighted share of each category amount by month. i.e

Jan 2024 category1 55% category2 45% Feb 2024 category1 60% category2 40%...

However, I keep getting lost in what approach to use.

I've created a line graph with the categories in the legend, date on x-axis and then made a measure

Cat_measure = divide( sum(table[amount]), all(table[amount])

I figured this would take the legend filtered sum divided by the unfiltered sum by date. However, sum and all returns the same result in this instance. I feel like I'm taking the wrong approach but not sure how to attack this.


Solution

  • Try:

    Cat_measure = 
      DIVIDE(
        SUM(YourTable[amount]),
        CALCULATE( SUM(YourTable[amount]), REMOVEFILTERS(YourTable[category]) )
      )
    

    You want to remove the context on category.
    You can also use ALL(YourTable[category])