[英]Repeat Callers - Power BI Measure or Calculated Column?
I have a database of call details and need to get a count of calls that are repeat callers within a 2 day time frame.我有一个呼叫详细信息数据库,需要在 2 天的时间范围内获取重复呼叫者的呼叫计数。 Picture of columns in DB table
DB表中列的图片
I have attempted this in a couple different ways.我已经尝试过几种不同的方式。
Calculated Column -计算列 -
RC1 =
CALCULATE(COUNTROWS(CallDetails),
FILTER(CallDetails,
CallDetails[Customer ID]=EARLIER(CallDetails[Customer ID]) &&
CallDetails[Call Start Date]>=DATEADD(CallDetails[Call Start Date],2,day)))
Measure -措施 -
RC2 =
CALCULATE(CallDetails[Incoming Call Count],
FILTER( ALLEXCEPT(CallDetails,CallDetails[Customer ID])
,CallDetails[Call Start Date]<=DATEADD(CallDetails[Call Start Date],2,day)
)
)
Neither have been correct and I have reached the end of my knowledge in DAX so far.两者都不是正确的,到目前为止,我对 DAX 的了解已经到了尽头。 How can this be done?
如何才能做到这一点?
Try this measure
:试试这个
measure
:
RC1 =
VAR T1 =
ADDCOLUMNS (
CallDetails,
"Count",
CALCULATE (
COUNTROWS ( CallDetails ),
FILTER (
CallDetails,
CallDetails[Customer ID] = EARLIER ( CallDetails[Customer ID] )
&& ABS ( CallDetails[Call Start Date] - EARLIER ( CallDetails[Call Start Date] ) ) <= 2
)
)
)
VAR T2 =
GROUPBY (
T1,
CallDetails[Customer ID],
"MaxCount", MAXX ( CURRENTGROUP (), [Count] )
)
RETURN
SUMX ( T2, 0 + ( [MaxCount] > 1 ) )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.