颜色三个最差的性能类别在条形图功能BI中
我想在带有不同颜色的条形图中通过销售显示三个最差的表现子类别。这是我目前正在处理的dasboard,您可以在此处获取数据示例 sales sales超级明星数据集示例。
有任何措施的想法吗?请提前
编辑:我以以下措施解决了:
Top N =
IF
(SELECTEDVALUE(
superstore[Sub-Category])
IN TOPN (
3,
FILTER(
ALLSELECTED(
superstore[Sub-Category]),
CALCULATE(
SUM(
superstore[Sales]))>0),
CALCULATE(SUM(superstore[Sales])),
ASC),
"#FD625E",
"#01B8AA"
)
I would like to display the three worst performing sub-categories by sales in a bar chart with a different color. This is the dasboard I'm currently working on, you can get a sample of the Data here Sales Superstore Dataset Sample.
Any ideas for a measure? Thanks in advance
edit: I solved it with following measure:
Top N =
IF
(SELECTEDVALUE(
superstore[Sub-Category])
IN TOPN (
3,
FILTER(
ALLSELECTED(
superstore[Sub-Category]),
CALCULATE(
SUM(
superstore[Sales]))>0),
CALCULATE(SUM(superstore[Sales])),
ASC),
"#FD625E",
"#01B8AA"
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
进行一些调试,这是最终的结果,并且应该对您有用。过滤后条形图未着色的原因是,在度量内生成的表格将不相关子类别的空白值放入当前选定的过滤器中,而不是删除它们。下面的代码正是这样做的,它应该是这样的。检查一下并告诉我是否解决了您的问题。
结果:

A bit of debugging and here is the final result that work and should work for you either. The reason why the bars are not colored after filtering is that, the table that is generated inside your measure put blank values for non-related sub-categories to current selected filter instead of removing them. The code below is doing exactly that, what it should be. Check it out and let me know if it solved your problem.
Result:

您可以使用此视频中所示的DAX函数开关:
https 。
You can use the DAX function SWITCH as shown in this video:
https://www.youtube.com/watch?v=fOErC7eaWZ0&ab_channel=RADACAD
Let me know if it works for you
我注意到,条件格式不适用于条形图。但是我们可以通过替代方式实现。
希望它能解决您的查询。请参阅屏幕截图
I noticed, Conditional formatting not available for bar charts. But we can achieve by alternate way.
Hope it will resolve your query.Please refer screenshot