Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
gumis_rulez
Helper I
Helper I

Column chart formatting based on parameter

Hi,

 

I am using dax function to create dynamically table with number of clients in each segment. The function is as follows:

 

All Customers Count =
Var CustomerOrders =

    SUMMARIZE(
        Orders,
        Orders[CompanyName],
        "Orders Count", DISTINCTCOUNT(Orders[OrderID])
    )

Return
    COUNTROWS(FILTER(CustomerOrders, [Orders Count]='Customer Segmentation'[Customer Segmentation Value]))

 

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?

 

test.JPG

 

1 ACCEPTED SOLUTION

Sure, only a slight modification of the expression is required, sorry for misunderstanding your needs before.

 

xifeng_L_0-1716828974391.png

 

Demo - project_one_issue.pbix

 

View solution in original post

6 REPLIES 6
xifeng_L
Super User
Super User

Hi @gumis_rulez ,

 

You need to create a measure and use it to the conditional formatting of bar color, can refer to below demo.

 

xifeng_L_0-1716823947358.png

 

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 

test2.JPG

 

It should change color based on the customer segmentation; below 7 as on this picture orange.

@gumis_rulez 

 

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.

 

xifeng_L_0-1716826923059.png

 

Demo - project_one_issue.pbix

 

 

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:

 

test3.JPG

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.

 

xifeng_L_0-1716828974391.png

 

Demo - project_one_issue.pbix

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.