Hi @Benn_Bennett : Would this work for you ?
Ok, I know my sample above will probably seem complicated , but it’s not .
What I did was this :
I’ve created a table People & Stages
, a table Stages
and a table Colors
.
I used the Stages
table to define the Min %
, Max %
and the Max% - Min%
for each of the stages you’ve mentioned (Beginning, Middle and End). This table is link to the table People & Stages
using a lookup so you can select the current stage for each person in the table.
(The same thing was similarly done in the doc you shared in your post : with the Max
, Spent
and Remaining
fields )
The Colors
table is there so I can define the colors I’m using in the progress bar and because if you want to change the colors, it’s way easier that way .
Ok, now, for the ugly part : here’s what my progress bar formula actually looks likes :
SwitchIf(
thisRow.Stages=Beginning,
Concatenate(
Rectangle(thisRow.Stages.Max*150,10,Colors.Filter(Usage="Current Stage").Hex),
Rectangle(thisRow.Stages.Left*150,10,Colors.Filter(Usage="Left").Hex)
),
thisRow.Stages=Middle,
Concatenate(
Rectangle(thisRow.Stages.Min*150,10,Colors.Filter(Usage="Passed").Hex),
Rectangle(thisRow.Stages.[Max-Min]*150,10,Colors.Filter(Usage="Current Stage").Hex),
Rectangle(thisRow.Stages.Left*150,10,Colors.Filter(Usage="Left").Hex)
),
thisRow.Stages=End,
Concatenate(
Rectangle(thisRow.Stages.Min*150,10,Colors.Filter(Usage="Passed").Hex),
Rectangle(thisRow.Stages.[Max-Min]*150,10,Colors.Filter(Usage="Current Stage").Hex)
)
)
SwitchIf()
is kind of working like If()
, with the exception that you don’t need to precise the “otherwise
” part of the formula, like you would do with an If()
. And here, it would have become a long nested one …
(More info about SwitchIf())
And basically, it says this :
If Stages
= Beginning
then Concatenate()
this Rectangle()
and this other Rectangle()
.
If Stages
= Middle
then Concatenate()
this Rectangle()
,this Rectangle()
and this other Rectangle()
too.
If Stages
= End
then Concatenate()
this Rectangle()
and this other Rectangle()
.
Now, the Rectangle() formula looks like this : Rectangle(width, height, color, name)
As stated in this topic and specifically this part :
It means, in other words that you can put multiple rectangles next to each other (in a Concatenate()
formula) and indicate as the Width
for each of those rectangles a percent of the total Width
of the whole bar .
For example, if I only take the Concatenate()
for when the Stage
=Beginning
(where you just need 2 rectangles. One for the current stage and one for the rest) :
Concatenate(
Rectangle(thisRow.Stages.Max*150,10,Colors.Filter(Usage="Current Stage").Hex),
Rectangle(thisRow.Stages.Left*150,10,Colors.Filter(Usage="Left").Hex)
)
The Width
of the first rectangle = thisRow.Stages.Max*150
thisRow.Stages.Max
is the value I’ve put as a maximum percent for the Beginning
stage in the table Stages
, which is here = 33%
(as you only have 3 stages (100/3 = ± 33)) .
The 150
is the total Width
of the “bar” (where the bar = the rectangle 1 + the rectangle 2).
So the actual Width
of that specific rectangle = 33% of 150
( thisRow.Stages.Max
*
150
)
(Coda does the math here all by itself ).
For the Height
I’ve used 10 .
And the Color
is the one I’ve define in the Colors
table for the Current
stage
The second rectangle here follow the same principle but using the Left %
.
And then, it all just begins again with the next Stage
.
(Except that you need 3 rectangles for the Middle
stage : One to represent the passed stage, one for the current and one for the stage to come )
I did prefer to use a separated table for the colors because once the formula is set-up, you can easily change the colors (otherwise, you’ll need to modify accordingly each Hex
value manually in each rectangles)
And of course, you can pre-define the Total Width
of the “bar” and the Height
by using sliders on the canvas (or others) (like in the doc you shared) the same way I pre-define the colors.
You’ll just need to indicate in the diverse Rectangle()
formulas where to get those values .
Note that : If you modify the text in the Usage
field (which is used for the colors of the rectangles), you’ll need to update it also in the filters in the Color
part of the Rectangle()
formula .
Sorry, I it’s quite long but it’s not easy to explain with words .
It might not be exactly what you wanted but I hope this help a little .