简体   繁体   English

Power BI:如何有条件地格式化 Power BI DAX 中的表格行

[英]Power BI: How to conditionally format a row of a table in Power BI DAX

I am new to DAX and I need help to colour the background of a row in table using DAX.我是 DAX 新手,我需要帮助使用 DAX 为表格中的一行背景着色。

Name姓名 text文本
Book Ora奥拉
Pencil铅笔 hjui

I want to colour the entire row of table with Name = Book in ORange我想用 Name = Book in ORange 为整行表着色

Can someone help me有人能帮我吗

Yes, it is possible using conditional formatting .是的,可以使用条件格式

In the Fields pane, right click your table and create the following measure:在“ Fields窗格中,右键单击您的表并创建以下度量:

Background color = IF(MAX('Table'[Name]) = "Book", "Orange", BLANK())

Then select the table visual and in Visualizations pane, right click each of the columns and select Conditional formatting -> Background color :然后 select 表格视觉和在Visualizations窗格中,右键单击每一列和 select Conditional formatting - > Background color

在此处输入图像描述

In Format by select Field value and select the above created measure in Based on field :在 select Field value和 select Format by中,上述Based on field创建的度量:

在此处输入图像描述

After you do that for each column shown, the result will be as follows:对显示的每一列执行此操作后,结果将如下所示:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM