The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Team,
I am tryig to build clustered bar chart. My data looks similar to the below. I dropped VENDOR in Y axis, Quantity under X Axis, and ORDER_DATE in legends, to get the quantity comparision for each vendor across dates. The data will refresh every day and new dates will get loaded into the table(Every time the data refreshes it will only load 2 distinct dates, i.e.., It will not have more than 2 distinct dates in ORDER_DATE COLUMN). Now, I want to apply custom color for these 2 dates, example organge for max date and blue for min date.
I guess data color option is moved to folIowing menu so I went into Format your Visual--> Visual --> bars --> applied colors manually for different dates, But next time when data refreshes it will be different dates so the power Bi is converting the colors to its default.
My requirement over here is i want orange color for the max date and blue color for min date(When I drop ORDER _DATE to Legends, Conditional format(fx) is not visible next to bars(COLOR) in format your visual tab.
Note: I imported this data into POWER BI using direct query option with SQL and database connection.
ORDER_DATE | VENDOR | QUANTITY |
13-FEB-2025 | 1A | 10 |
13-FEB-2025 | 2B | 20 |
13-FEB-2025 | 3C | 10 |
06-FEB-2025 | 1A | 15 |
06-FEB-2025 | 2B | 25 |
06-FEB-2025 | 3C | 35 |
Please help me with this requirement.
Thank you!
Power BI February 2025 PowerBI desktop Release Power BI Desktop Version Issue Power BI Clustered Column Chart Conditional formatting and Analytic line in Power BI Service Default Power BI colors for Data Bars
Solved! Go to Solution.
Create a mesure for color logic:
Order Date Color =
VAR _MaxDate = MAX('YourTable'[ORDER_DATE])
VAR _MinDate = MIN('YourTable'[ORDER_DATE])
RETURN
SWITCH(
SELECTEDVALUE('YourTable'[ORDER_DATE]),
_MaxDate, "#FF5733", -- 🔶 Orange for the latest date
_MinDate, "#3498DB", -- 🔷 Blue for the older date
"#808080" -- Default Gray (just in case)
)
Then apply condiotional formatting based on this measure.
Hi @Raghu3636,
Actually, there is no direct way to apply conditional format for a dynamic date on the Legend in Power BI, which is by design.
If you want this feature to be supported, you could raise an idea here:
https://ideas.fabric.microsoft.com/
As a workaround, you could consider to configure your bar chart as below, then create a measure to apply this condition format:
Date Color =
VAR MaxDate = CALCULATE(MAX('Table'[ORDER_DATE]), ALL('Table'))
VAR MinDate = CALCULATE(MIN('Table'[ORDER_DATE]), ALL('Table'))
VAR CurrentDate = VALUES('Table'[ORDER_DATE])
RETURN
SWITCH(
TRUE(),
CurrentDate = MaxDate, "Max",
CurrentDate = MinDate, "Min",
"Other"
)
Here is the .pbix file for your reference:
Hi @Raghu3636,
Actually, there is no direct way to apply conditional format for a dynamic date on the Legend in Power BI, which is by design.
If you want this feature to be supported, you could raise an idea here:
https://ideas.fabric.microsoft.com/
As a workaround, you could consider to configure your bar chart as below, then create a measure to apply this condition format:
Date Color =
VAR MaxDate = CALCULATE(MAX('Table'[ORDER_DATE]), ALL('Table'))
VAR MinDate = CALCULATE(MIN('Table'[ORDER_DATE]), ALL('Table'))
VAR CurrentDate = VALUES('Table'[ORDER_DATE])
RETURN
SWITCH(
TRUE(),
CurrentDate = MaxDate, "Max",
CurrentDate = MinDate, "Min",
"Other"
)
Here is the .pbix file for your reference:
Create a mesure for color logic:
Order Date Color =
VAR _MaxDate = MAX('YourTable'[ORDER_DATE])
VAR _MinDate = MIN('YourTable'[ORDER_DATE])
RETURN
SWITCH(
SELECTEDVALUE('YourTable'[ORDER_DATE]),
_MaxDate, "#FF5733", -- 🔶 Orange for the latest date
_MinDate, "#3498DB", -- 🔷 Blue for the older date
"#808080" -- Default Gray (just in case)
)
Then apply condiotional formatting based on this measure.
User | Count |
---|---|
77 | |
76 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
79 | |
57 | |
48 | |
48 |