我建议有一个表格来根据最小值和最大值定义颜色编码。
创建了一个临时表来展示它是如何完成的,我没有得到你拥有的所有组合,但是使用了一个示例数据集
使用的 SQL
select * INTO #Data
from (
Select 1 AS Counts,75 AS Value,'Total Orders' AS Category UNION ALL
Select 1 AS Counts,250 AS Value,'Avg Orders' AS Category UNION ALL
Select 1 AS Counts,10 AS Value,'Avg Value' AS Category UNION ALL
Select 1 AS Counts,13 AS Value,'Running 1st' AS Category UNION ALL
Select 1 AS Counts,'' AS Value,'Running 2nd' AS Category UNION ALL
Select 1 AS Counts,'' AS Value,'Running 3rd' AS Category UNION ALL
Select 2 AS Counts,23 AS Value,'Total Orders' AS Category UNION ALL
Select 2 AS Counts,46 AS Value,'Avg Orders' AS Category UNION ALL
Select 2 AS Counts,30 AS Value,'Avg Value' AS Category UNION ALL
Select 2 AS Counts,34 AS Value,'Running 1st' AS Category UNION ALL
Select 2 AS Counts,'' AS Value,'Running 2nd' AS Category UNION ALL
Select 2 AS Counts,'' AS Value,'Running 3rd' AS Category UNION ALL
Select 3 AS Counts,'' AS Value,'Total Orders' AS Category UNION ALL
Select 3 AS Counts,23 AS Value,'Avg Orders' AS Category UNION ALL
Select 3 AS Counts,55 AS Value,'Avg Value' AS Category UNION ALL
Select 3 AS Counts,67 AS Value,'Running 1st' AS Category UNION ALL
Select 3 AS Counts,77 AS Value,'Running 2nd' AS Category UNION ALL
Select 3 AS Counts,'' AS Value,'Running 3rd' AS Category ) a
select * INTO #Colors
from (
select 'Green' color, 1 min_value , 50 max_value UNION ALL
select 'Yellow' color, 51 min_value , 100 max_value UNION ALL
select 'Red' color, 101 min_value , 1000 max_value
) b
select a.Category, a.Counts, a.Value, b.color
from #Data a
left join #Colors b
on a.Value between b.min_value and b.max_value
drop table #Colors
drop table #Data
这将为输出提供您想要的颜色
输入数据集是
输出看起来像这样
如果您有一张实体桌子,您可以灵活地使用桌子改变颜色。
设计窗口
在颜色值上添加背景表达式