[英]Variance between row values in same table based on selected filter values - Power BI
I am trying to return the variance values between rows based off of multiple filter values.我正在尝试根据多个过滤器值返回行之间的方差值。
Data set looks like this:数据集如下所示:
Bid Name![]() |
Service Area![]() |
Task Name![]() |
Resource![]() |
Hours![]() |
Revenue![]() |
---|---|---|---|---|---|
Bid 1![]() |
SA1 ![]() |
Fix the lights![]() |
R1 ![]() |
75 ![]() |
100 ![]() |
Bid 2![]() |
SA1 ![]() |
Fix the lights![]() |
R1 ![]() |
100 ![]() |
175 ![]() |
What I am looking for, is something like this:我正在寻找的是这样的:
Slicer 1![]() |
---|
Bid 1 (selected)![]() |
Bid 2![]() |
Slicer 2![]() |
---|
Bid 1![]() |
Bid 2 (selected)![]() |
Service Area![]() |
Task Name![]() |
Resource![]() |
Hours![]() |
Revenue![]() |
---|---|---|---|---|
SA1 ![]() |
Fix the lights![]() |
R1 ![]() |
25 ![]() |
75 ![]() |
I have tried a lot of variations using calculate and all selected and tried copying the table and using one slicer on table 1 and the other on table 2. A few nuances:我尝试了很多变体,使用计算并全部选择并尝试复制表并在表 1 上使用一个切片器,在表 2 上使用另一个切片器。一些细微差别:
If there is a better way to do this without the slicers I am fine to do it without.如果没有切片机有更好的方法可以做到这一点,我可以不用切片机。
Any help is greatly appreciated.任何帮助是极大的赞赏。
You'll need to create a separate table for each slicer and neither of these slicer tables should be related to your data table or each other.您需要为每个切片器创建一个单独的表,并且这些切片器表都不应该与您的数据表或彼此相关。
That is, two calculated tables即两个计算表
Slicer1 = VALUES ( Data[Bid Name] )
Slicer2 = VALUES ( Data[Bid Name] )
Then you write a measure that reads the slicers and calculates the difference (and returns a blank if the difference is zero).然后编写一个读取切片器并计算差异的度量(如果差异为零,则返回空白)。
HourDiff =
VAR Bid1 = SELECTEDVALUE ( Slicer1[Bid Name] )
VAR Bid2 = SELECTEDVALUE ( Slicer2[Bid Name] )
VAR Hours1 = CALCULATE ( SUM ( Data[Hours] ), Data[Bid Name] = Bid1 )
VAR Hours2 = CALCULATE ( SUM ( Data[Hours] ), Data[Bid Name] = Bid2 )
RETURN
IF (
ISBLANK ( Hours1 ) || ISBLANK ( Hours2 ) || Hours1 = Hours2,
BLANK(),
Hours2 - Hours1
)
The measure for RevenueDiff
is analogous. RevenueDiff
的度量是类似的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.