Forum Discussion
Add conditional formatting to sparkline by DAX
Hello,
I'm a Power BI user who (unfortunately) doesn't know DAX. I need to conditionally format the columns on a sparkline bar graph. I was very happy to find your post on this topic and have tried to adapt your code to my use case...without success.
I have a sample .pbix file that illustrates my use case, but don't see any way to attach it to this message, so I've put some sample data in the below table and will try to describe what I need to do.
I need to create 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 - that I can do. 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.
Any help would be greatly appreciated.
Thank you,
Marc
| DATE | UNIQUE_ID | PCT_CHANGE_1WEEK |
| 06/08/2023 | A | -0.349 |
| 06/01/2023 | A | -6.181 |
| 05/25/2023 | A | 0 |
| 06/08/2023 | B | 0.56 |
| 06/01/2023 | B | -0.11 |
| 05/25/2023 | B | 0 |
| 06/08/2023 | C | 1.493 |
| 06/01/2023 | C | -1.78 |
| 05/25/2023 | C | 0 |