多列的条件格式问题 [英] Conditional formatting for multiple columns issue

查看:133
本文介绍了多列的条件格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Power BI的新手。有人请为我提供以下问题的解决方案。

I am new to Power BI. Some one please provide me a solution for the following issue.

我有一个双标题矩阵,客户位于行中,两列状态和说明位于列部分中(两列均来自相同的查找表),然后在值部分中进行测量,以在矩阵中显示不同的计数。以下是DAX。

I have a double heading matrix where customers are in Rows, two columns Status and Description are in the columns section (Both columns are from same lookup table), and a measure in the values section which will display the distinct count in the matrix. Following is the DAX.

DistinctRoster:= IF(CALCULATE(DISTINCTCOUNT(FactStatus [RosterId]))= BLANK(),0,CALCULATE(DISTINCTCOUNT(FactStatus [RosterId])))

DistinctRoster:= IF(CALCULATE(DISTINCTCOUNT(FactStatus[RosterId])) = BLANK(), 0, CALCULATE(DISTINCTCOUNT(FactStatus[RosterId])))

矩阵就像

矩阵

图片2

问题:我必须为基于事实表中的放置持续时间列的活动展示位置和基于事实表中的待定持续时间列的待定列实现背景颜色。

Issue: I have to implement background color for column Active placements based on column Placed Duration in Fact table and for column Pending based on column Pending Duration in fact table.

我通过设置条件格式->为活动展示位置列添加了背景色。按规则格式化->并在野外获得基础。

I added background color for column Active Placements by going to conditional formatting --> Format By rules--> and BAsed on field. It worked great for that column.

图片3

但是我如何实现待定列的背景颜色?

But how i can implement the background color for column Pending? I got stuck at this point.

TIA。

推荐答案

何时申请在基于一种度量的矩阵中使用不同的条件列格式,您可以构建一个支持度量,在该度量上应用条件格式。

When you want to apply different conditional column formatting in a matrix that is based on one measure, you could built a supportive measure, on which you'll apply the conditional formatting.

假设该字段的字段矩阵是表 [描述],两个可能的值:值1。 & 值2而您的度量是[度量1]和[度量2]。

Suppose the field in the column of the matrix is 'Table'[Description], two possibles values: "Value 1" & "Value 2" and your measures are [Measure 1] and [Measure 2].

要知道用于格式化的度量,请使用SELECTEDVALUE()函数。

To 'know' which measure to use for the formatting, you use the SELECTEDVALUE() function.

[Measure for formatting] =
VAR __SELECTED =
    SELECTEDVALUE ( 'Table'[Description] )
RETURN
    SWITCH ( __SELECTED, 
    "Value 1", [Measure 1], 
    "Value 2", [Measure 2], 0 )

已翻译:如果该列上有值1,则选择度量1,如果该列上的值2,则选择度量2。否则:0(对于总格式很重要!)

Translated: If there's Value 1 on the column, pick Measure 1, if Value 2 on the colum, pick Measure 2. Otherwise: 0 (important for total formatting!)

现在到了棘手的部分:如果两个度量的阈值都在同一范围内,则必须在该值上添加一个数字/多义字符以分隔格式。

Now comes the tricky part: if the threshold values for both measures are in the same range, you must add a number/mutiplier to the value, to seperate the formatting.

请执行以下操作:

[Measure for formatting] =
VAR __SELECTED =
    SELECTEDVALUE ( 'Table'[Description] )
RETURN
    SWITCH ( __SELECTED, 
    "Value 1", [Measure 1], 
    "Value 2", [Measure 2] + 100000, 0 )

现在您可以建立规则:

Now you can build your rules:


  • 0 =无格式(总计)

  • 范围1到< 100000 =值/度量1的格式
  • 范围> = 100000 =格式化为Value / Measure2

(因此,大于80会大于100080 2)

(so greater than 80 becomes greater than 100080 for measure 2)

这篇关于多列的条件格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆