The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello Community - I have these two measure, which work perfectly fine.
However, I'm having a bit of challenge using these (or the logic within them) to create a calculated column that would essentially be a toggle between New or Returning Customer. So, if I wanted to see a column of all new customers, I could easily do so, or likewise if I wanted to see a column of returning customers.
I obviusly need a calculated column to define, at the row level, who is returning, and who is new. Just not sure how to utilize what I have so far to create this column.
Returning Customers =
VAR _CustomerList = CALCULATETABLE(VALUES(SalesOrdersALL[CustNum_Cust_Seq_Orders]),USERELATIONSHIP('Dim_Date Table'[Date],SalesOrdersALL[Order Date]))
VAR _ReturningCustomers = (CALCULATETABLE(VALUES(SalesOrdersALL[CustNum_Cust_Seq_Orders]),USERELATIONSHIP('Dim_Date Table'[Date],SalesOrdersALL[Order Date]),
(FILTER(ALL('Dim_Date Table'[Date]),
'Dim_Date Table'[Date] > MIN('Dim_Date Table'[Date]) - [Churn Time Frame Value]
&& 'Dim_Date Table'[Date] < MIN('Dim_Date Table'[Date])))))
RETURN
COUNTROWS(INTERSECT(_CustomerList,_ReturningCustomers))
New Customers = //calculating which customers within any particular month have purchased but haven't done so for the last X number of days
VAR _CustomersThisMonth = CALCULATETABLE(VALUES(SalesOrdersALL[CustNum_Cust_Seq_Orders]),USERELATIONSHIP('Dim_Date Table'[Date],SalesOrdersALL[Order Date]))
VAR _PriorCustomers = CALCULATETABLE(VALUES(SalesOrdersALL[CustNum_Cust_Seq_Orders]),USERELATIONSHIP('Dim_Date Table'[Date],SalesOrdersALL[Order Date]),
FILTER(ALL('Dim_Date Table'[Date]),
'Dim_Date Table'[Date] > MIN('Dim_Date Table'[Date]) - [Churn Time Frame Value]
&& 'Dim_Date Table'[Date] < MIN('Dim_Date Table'[Date])))
VAR _NewCustomers = COUNTROWS(EXCEPT(_CustomersThisMonth,_PriorCustomers))
RETURN
_NewCustomers
@lbendlin Yes, that is clear. My question is really how can I take the results of the above measures, and create a calculated column from their results. In another words, a column that list whether a customer is a new or return customer (based on the results of the measures).
Hi, @Anonymous
Can you provide a simple PBIX file for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.
Best Regards
You cannot create columns from measures. Convert your measures to calculated columns, do your computations in Power Query, or do them further upstream.
You cannot create columns from measures. These concepts (immutable vs mutable) are not reversible.
User | Count |
---|---|
58 | |
56 | |
53 | |
49 | |
32 |
User | Count |
---|---|
172 | |
89 | |
70 | |
46 | |
45 |