找到客户的第一个月订单数量。

huangapple go评论56阅读模式
英文:

Find number of orders for customer first month

问题

我是新手Power BI,正在学习如何在Power BI中使用DAX进行同期分析。有没有办法找出客户第一个月购买多少次(或者更容易的是,如果客户购买超过某个阈值)?

如果我有一个客户表:
ID | 第一次注册日期

和订单表:
ID | 客户ID | 订单日期

如果有更多信息有帮助,请告诉我!
编辑:如果可能的话,是否可以将它绘制在一个矩阵中,每一行都是客户,每一列都是第1到第3个月?

谢谢

英文:

I am new to Power BI and learning how to perform cohort analysis with DAX in Power BI. Is there any way to find out how many times (or if easier if a customer buys more than a certain threshold) their first month?

If I have the table Customers:
ID | DateOfFirstRegistration

And the table of orders:
ID | customerId | orderDate

Let me know if any more information is helpful!
EDIT: If possible, is it also possible to plot it in a matrix with customers in each row and month 1 through 3 in the columns?

Thank you

答案1

得分: 0

你可以在表格可视化中与客户ID一起执行类似这样的度量:

首月购买 = 
VAR _registration = 
    SELECTEDVALUE ( 'customers'[DateOfFirstRegistration] )
RETURN
    CALCULATE ( 
        COUNTROWS ( 'orders' ) , 
        DATESINPERIOD ( 
            'orders'[orderDate] , 
            _registration , 
            1 , 
            MONTH 
        )
    )

注意:这是一段包含了DAX (Data Analysis Expressions) 语言的代码,通常用于Power BI等数据分析工具中。

英文:

You can do something like this measure in a table visualization together with customer ID:

First Month Purchases = 
VAR _registration = 
    SELECTEDVALUE ( 'customers'[DateOfFirstRegistration] )
RETURN
    CALCULATE ( 
        COUNTROWS ( 'orders' ) , 
        DATESINPERIOD ( 
            'orders'[orderDate] , 
            _registration , 
            1 , 
            MONTH 
        )
    )

huangapple
  • 本文由 发表于 2023年2月13日 23:02:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75437617.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定