英文:
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
)
)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论