I've created a table showing, by UNIQUE_ID, the Average of PCT_CHANGE_1WEEK by DATE in a sparkline bar graph...with a slicer allowing the user to choose multiple DATEs to present.
Table/sparkline without conditional formatting
What I'd like to do is have the bars be green for positive values and red for negative values - this is what I haven't been able to figure out.
I've searched the internet and found a few solutions to similar questions (most notably: https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Add-conditional-formatting-to-sparkline-by-DAX/m-p/3308290#M7725), but due to my lack of knowledge in DAX programming, I haven't been able to adapt the code to my specific use case.
Sample data
| DATE | UNIQUE_ID | PCT_CHANGE_1WEEK |
|---|---|---|
| 6/8/2023 | A | -0.349 |
| 6/1/2023 | A | -6.181 |
| 5/25/2023 | A | 0 |
| 6/8/2023 | B | 0.56 |
| 6/1/2023 | B | -0.11 |
| 5/25/2023 | B | 0 |
| 6/8/2023 | C | 1.493 |
| 6/1/2023 | C | -1.78 |
| 5/25/2023 | C | 0 |