最近90天内购买和未购买某些产品的客户 [英] Customers who bought and not bought some product in last 90 days

查看:103
本文介绍了最近90天内购买和未购买某些产品的客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个轻率的度量来向我显示最近90天内哪些顾客购买了产品B和C。

I need a dax measure which shows me which customers bought products B and C in last 90 days.

另外一个向我显示了那些购买了产品B和C的顾客过去90天内的C。

And another one which shows me those whose bought products B and C in last 90 days.

(基于我的过滤日期上下文)

(based in my filter date context)

下面是应该的:

有人可以帮助我吗?

如果需要,这里是一个示例数据:

Here is a sample data if needed:

事实销售

KeyDate KeyCustomer KeyProduct  Total
1   1   1   12,9
1   2   2   13
1   3   1   156,4
1   4   1   564,8
2   1   1   894,8
2   2   1   56,5
3   1   2   564,85
3   2   3   564,8
4   1   1   1325,6
4   2   1   132,3

客户

KeyCustomer Name
1   Jean
2   Mari
3   Lisa
4   Julian
5   Jhonny

日历

KeyDate Date
1   01/01/2018
2   02/01/2018
3   01/05/2018
4   01/08/2018

产品

KeyProduct  Product
1   A
2   B
3   C


推荐答案

尝试以下方法:

IfBought = IF(
              COUNTROWS(
                  FILTER(FactSales,
                      RELATED('Product'[Product]) IN {"B", "C"} &&
                      RELATED('Calendar'[Date]) > TODAY() - 90)
                  ) > 0,
              1, 0)

请注意,5月1日比90天前更长但是今天,所以除非将 90 更改为 114 或更高,否则您不会得到想要的结果。

Note that May 1st is longer than 90 days ago as of today though, so you won't get the result you asked for unless you change 90 to 114 or greater.

这篇关于最近90天内购买和未购买某些产品的客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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