Unable to Display Stacked Bar Due to Partition Beast Mode

At the base, my dataset is broken up by employeeID, months, and planID. For each of the employees, month and plan; the employee receives a $ value based on performance, called "Earned" and they also have a column "Funded" that indicates what they were funded for the plan and month.


I am trying to create a card that displays the month on the x-axis (with the option to use different graph by groupings like quarter, using the month date value) and the y-axis will show a distinct count of plans for the given timeframe broken up by a color grouping. The color grouping should be calculated based on the earned and funded value for the plan for the given timeframe. The general logic is

Budget color rules by plan and timeframe:

Earned < 85% of the Funding amount = Yellow

Earned between 85-115% of the Funding amount = Green

Earned > 115% of the Funding amount = Red

Ex//

The x-axis is displaying quarters and the y-axis might show 100 distinct plans for the quarter, but 25 are green, 50 are yellow, and 25 are red - as a stacked bar.


I believe I have the plan color beast mode setup correctly for the color rules (screenshot below) since when I display the data in a table it seems to be calculating everything correctly (screenshot below). The table shows the month, plan color, planID and then the calculation that I use to determine the color of the plan - the same as the beast mode, just without the THEN 'colors'


I'm running into the issue when I try to create the stacked bar chart. What I have done for similar situations is using a distinct count for the y-axis and then include the colors in the series to differentiate/break out the distinct count on the y-axis. I think because my beast mode uses partition by planID I'm not able to aggregate for the entire timeframe on the x-axis. Below is a screenshot of what I see, the y-axis value is a beast mode that is just 'COUNT(DISTINCT `PLANCODEID`)'


I'm not sure if there is a better way to do this, but I don't believe I can do the color beast mode in the dataflow since they want to be able to change the x-axis timeframe between months and quarters, eventually years - quarters will also be the default, it's just easier to show in months for this.

Any help/ideas would be greatly appreciated!