Forum Discussion
PBI_Member_01
Helper III
3 years agoCalculate Average Days for First Order (For All Customers)
Hi everyone, I am having troubles creating this measure in Power BI. The dataset I am connected to is DirectQuery. Please see image below for reference. I want to create a measure which a...
- 3 years ago
Ok I hope this will work
Days To First Order = AVERAGEX ( VALUES ( CUSTOMER[Cust ID] ), VAR DateCreated = CALCULATE ( MAX ( CUSTOMER[Cust Date Created] ) ) VAR FirstOrderDate = CALCULATE ( MIN ( ORDERS[Order Date] ), ORDERS[Order Type] IN { "A", "B" } ) RETURN DATEDIFF ( DateCreated, FirstOrderDate, DAY ) )
Karthikstark
3 years agoFrequent Visitor
You can try this measure
AverageDaysTakenForFirstOrderForA&B =
DIVIDE (
SUMX (
FILTER ( tableOfYourValues, orderType = "A" || orderType = "B" ),
timeToFirstOrder
),
COUNTROWS ( FILTER ( tableOfYourValues, orderType = "A" || orderType = "B" ) )
)