简体   繁体   English

PowerBI - 突出显示周末的条件格式

[英]PowerBI - conditional formatting for highlighting weekends

I have a data table matrix in power bi showing Dates in Rows and hours in columns and count of customers against them as values.我在 power bi 中有一个数据表矩阵,显示行中的日期和列中的小时数,以及针对它们的客户计数作为值。 i wanted to highlight all rows of thursday, friday and saturday, so that weekend figures can be compared.我想突出显示星期四、星期五和星期六的所有行,以便可以比较周末的数字。 Need help in this pls...在这方面需要帮助...

the table is in the below format enter image description here表格采用以下格式在此处输入图像描述

First you want to create a duplicate (in my case monday - friday (2) that does NOT have a relation to you source table. You want this duplicate table to only show days. This duplicate table needs a relationship with the slicer you are going to use to filter for days首先,您要创建一个副本(在我的情况下是星期一 - 星期五 (2),它与您的源表没有关系。您希望此重复表仅显示天数。此重复表需要与您要使用的切片器建立关系)用于过滤几天在此处输入图片说明

In your source table (monday - friday) you want to create the following measure:在您的源表(星期一 - 星期五)中,您要创建以下度量:

Measure = IF(HASONEVALUE('monday -friday (2)'[Day]);
    IF(SELECTEDVALUE('monday -friday (2)'[Day]) = MAX('monday -friday'[Day]); 1; 0);
    IF(ISFILTERED('monday -friday (2)'[Day]) && COUNTROWS(FILTER('monday -friday (2)'; 'monday -friday (2)'[Day] = MAX('monday -friday'[Day]))); 1; 0))

Now you want to create conditional formatting.现在您要创建条件格式。 First create your table with days and values (for the example i did not sort the table. You want to sort your table so it looks better):首先创建包含天数和值的表格(例如我没有对表格进行排序。您想对表格进行排序以使其看起来更好): 在此处输入图片说明

Then right click on values and select conditional formatting.然后右键单击值并选择条件格式。 Select based on rules.根据规则选择。 and the measure you just created in your source table.以及您刚刚在源表中创建的度量。 for the first option you select "is bigger than or equal to" and give it a value 1. for the second option you select "is smaller than"and give it a value 1000. Choose the color you want your highlights to be.对于第一个选项,您选择“大于或等于”并将其赋值为 1。对于第二个选项,您选择“小于”并将其赋值为 1000。选择您想要高光的颜色。 在此处输入图片说明

If you now select a day in your filter the value for that day will show the background color you selected!如果您现在在过滤器中选择一天,那一天的值将显示您选择的背景颜色! In your case you want to select all days you want to have highlighted.在您的情况下,您要选择要突出显示的所有日期。 在此处输入图片说明

Hope this helps!希望这可以帮助!

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

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