简体   繁体   English

表中的 Power BI DISTINCTCOUNT 值随切片器更改

[英]Power BI DISTINCTCOUNT in a table with value changing with slicer

I have got two separate tables.我有两张单独的桌子。 Table1 has got the data for each Contact types (A,B,C,D...) and Table2 has got the Assets in those contracts (Asset 1=A, Asset 2=A, Asset 3=C etc.).表 1 获得了每种联系人类型的数据(A、B、C、D...),表 2 获得了这些合同中的资产(资产 1=A、资产 2=A、资产 3=C 等)。

These tables are linked.这些表是链接的。

Now, I have got a slicer to filter only A and C and I have created a table.现在,我有一个切片器来仅过滤 A 和 C 并且我创建了一个表。 Also, I need to disable filtering values out by Month.另外,我需要按月禁用过滤值。

I want to show total number of assets in each contract dynamically when I click on A or C in the slicer as this is important for dynamic calculations (percentage etc.).当我在切片器中单击 A 或 C 时,我想动态显示每个合约中的资产总数,因为这对于动态计算(百分比等)很重要。 Also note, I need only A and C contract values as they are only active.另请注意,我只需要 A 和 C 合约值,因为它们仅处于活动状态。

I have used the measure below, which, although gives me correct value, but the slicer for A and C are not changing the value:我使用了下面的度量,虽然给了我正确的值,但是 A 和 C 的切片器没有改变值:

No of assets = CALCULATE(DISTINCTCOUNT('Table2'[Asset]),ALL('Table1'[Month]),Or('Table2'[Contract]="A",'Table2'[Contract]="C"))资产数量 = CALCULATE(DISTINCTCOUNT('Table2'[Asset]),ALL('Table1'[Month]),Or('Table2'[Contract]="A",'Table2'[Contract]="C") )

Just put a filter visual in your report and use the following measure in a KPI card:只需在您的报告中放置一个过滤器视觉对象并在 KPI 卡中使用以下度量:

No of Assets = DistinctCount('Table2'[Asset])

If your relationship is correctly set and you change values on your filter/slicer, the value of the measure will change too.如果您的关系设置正确并且您更改了过滤器/切片器上的值,则度量值也会发生变化。

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

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