Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi,
I want to get Dynamic color Green for Maximum value and Red for Minimum value in my column chart with field parameter.
Please advise how can it be done?
As per below example
Solved! Go to Solution.
Well, this got really ugly really fast...
bar color =
VAR da =
MAX( 'Date Axis'[Date Axis] )
VAR ma =
MAX( 'Measure Axis'[Measure Axis] )
VAR ts =
SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
VAR mv0 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Stat of Qtr],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
VAR mv1 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Start of Month],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
VAR mv2 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Week Start],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
VAR mv3 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Date],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
RETURN
SWITCH(
da,
"Stat of Qtr",
SWITCH(
TRUE(),
ts = MAXX( mv0, [v] ), "green",
ts = MINX( mv0, [v] ), "red",
"blue"
),
"Start of Month",
SWITCH(
TRUE(),
ts = MAXX( mv1, [v] ), "green",
ts = MINX( mv1, [v] ), "red",
"blue"
),
"Week Start",
SWITCH(
TRUE(),
ts = MAXX( mv2, [v] ), "green",
ts = MINX( mv2, [v] ), "red",
"blue"
),
"Date",
SWITCH(
TRUE(),
ts = MAXX( mv3, [v] ), "green",
ts = MINX( mv3, [v] ), "red",
"blue"
)
)
see attached
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Thank you for your response.
Please refer the attached file as per your requirement.
Well, this got really ugly really fast...
bar color =
VAR da =
MAX( 'Date Axis'[Date Axis] )
VAR ma =
MAX( 'Measure Axis'[Measure Axis] )
VAR ts =
SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
VAR mv0 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Stat of Qtr],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
VAR mv1 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Start of Month],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
VAR mv2 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Week Start],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
VAR mv3 =
CALCULATETABLE(
SUMMARIZE(
'Date',
[Date],
"v", SWITCH( ma, "Total Sales", [Total Sales], "Unit Sold", [Unit Sold] )
),
ALLSELECTED()
)
RETURN
SWITCH(
da,
"Stat of Qtr",
SWITCH(
TRUE(),
ts = MAXX( mv0, [v] ), "green",
ts = MINX( mv0, [v] ), "red",
"blue"
),
"Start of Month",
SWITCH(
TRUE(),
ts = MAXX( mv1, [v] ), "green",
ts = MINX( mv1, [v] ), "red",
"blue"
),
"Week Start",
SWITCH(
TRUE(),
ts = MAXX( mv2, [v] ), "green",
ts = MINX( mv2, [v] ), "red",
"blue"
),
"Date",
SWITCH(
TRUE(),
ts = MAXX( mv3, [v] ), "green",
ts = MINX( mv3, [v] ), "red",
"blue"
)
)
see attached
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 43 | |
| 38 | |
| 35 | |
| 21 | |
| 15 |
| User | Count |
|---|---|
| 63 | |
| 58 | |
| 28 | |
| 27 | |
| 25 |