简体   繁体   English

Power Bi中如何根据过滤器切换两个表中的数据

[英]How to switch data from two tables based on filter in Power Bi

I have two tables which have counts and sales based on dates and one of them also have customer ID.我有两张表,其中有基于日期的计数和销售额,其中一张也有客户 ID。 The counts are not same when we see by customer and summary.当我们看到客户和摘要时,计数是不一样的。 I also have customer filter on my dashboard.我的仪表板上也有客户过滤器。 What I want to achieve is if no customer is selected the count should come from summary table otherwise it should come from customer if multiple or one is selected in the filter.我想要实现的是,如果没有选择客户,则计数应该来自汇总表,否则如果在过滤器中选择了多个或一个,它应该来自客户。

Customer Table客户表

在此处输入图像描述

Summary Table汇总表

在此处输入图像描述

Any hints, I have tried lookupvalue function but I cant put date as search value from date table.任何提示,我都尝试过查找值 function 但我不能将日期作为日期表中的搜索值。

It's much easier to use Measures, instead of creating calculated tables to obtain those metrics.使用度量要容易得多,而不是创建计算表来获取这些指标。 Also, summarized tables would not have the same filter context your are looking for.此外,汇总表不会具有您正在寻找的相同过滤器上下文。

Measure 1措施 1

Total Customers = 
 DISTINCTCOUNT('Customer Table'[CustomerID])

Measure 2措施 2

Total Sales = 
 SUM ( 'Customer Table'[Sales])

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

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