Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I am using dax function to create dynamically table with number of clients in each segment. The function is as follows:
Would like to create a bar graph as below but formatted in two colors:
-- customers below selected value orange
-- customes above selected value dark blue
Any hints how to resolve this?
Solved! Go to Solution.
Sure, only a slight modification of the expression is required, sorry for misunderstanding your needs before.
Hi @gumis_rulez ,
You need to create a measure and use it to the conditional formatting of bar color, can refer to below demo.
Color =
VAR SelectedNum = SELECTEDVALUE('Parameter'[Parameter])
VAR CurCustCount = [All Customers Count]
RETURN
IF(CurCustCount<SelectedNum,"#e96b30","#118dff")
//IF(CurCustCount<SelectedNum,"orange","blue")
Demo - Column chart formatting based on parameter.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
I have followed your way and it seems it is not working. I am attaching my file.
https://drive.google.com/file/d/1gtJZnGAkEPzXYvMn77hH5eVAYzaaCMG3/view?usp=sharing
It should change color based on the customer segmentation; below 7 as on this picture orange.
You previously blocked the slicer's filtering of the visuals, resulting in slicer-selected values not being passed.
You need to create another parameter table and apply it to the slicer. Pls refer to below demo.
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Very interesting solution. For sure will use someday.
For this project the goal is to create conditional formating based on x-axis customer segmentation. If parameter = 4 then the graph should look as follows:
In your solution the conditional formating works based on the values for each of 20 segments. In the desired one, no matter the value - parameter formats the segments. Is it something which can be done?
Sure, only a slight modification of the expression is required, sorry for misunderstanding your needs before.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
10 | |
8 |