Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear Community,
Good day!
I have this measure which used to identify which clients are new based on the parameter (6 month) and also month & year of their ETD.
New Customers = //Cus
VAR CustomerTM = VALUES(Customer[Client])
VAR PriorCustomer = CALCULATETABLE(VALUES(Customer[Client]),
FILTER(ALL('Customer'),
'Customer'[ETD] > Min('Customer'[ETD] ) - Parameter[Parameter Value] && 'Customer'[ETD] < MIN('Customer'[ETD])))
return
COUNTROWS(
EXCEPT(CustomerTM,PriorCustomer))
My raw data:
There are no problems with the coding until the 'branch' slicer is added.
Based on my raw data, Nike should consider new customers for SIN branch in January, but for TYO branch in February.
But this code as a result, NIKE only had new customers on January, is there any part that I was missed?
Attached with pbix: https://drive.google.com/file/d/1mvW9opym6Ot2AlyZy0m0kl2rDeB4P2Wv/view?usp=sharing
Greatly appreciated any helps provided! Thank you!
Solved! Go to Solution.
Hi @NickProp28 ,
Try replacing filter(all...) with
New Customers2 =
//Cus
VAR CustomerTM = VALUES( 'Customer'[Client] )
VAR PriorCustomer =
CALCULATETABLE(
VALUES( 'Customer'[Client] ),
ALLEXCEPT('Customer', 'Customer'[Branch]),
DATESINPERIOD('Customer'[ETD].[Date], MIN('Customer'[ETD]) - [Parameter Value], [Parameter Value],DAY)
)
RETURN
COUNTROWS( EXCEPT( CustomerTM, PriorCustomer ) )
I'm not really sure what result you are looing for, but i gave it a shot:
Please locate you file here:
https://drive.google.com/drive/folders/1AjePk7NUXAloXHr42BEa2lDOr5dQr2Wg
Dear @NickolajJessen ,
Appreciate your response, but the code doesn't work since my raw data do not have any March /April data
Thank you
Then i don't understand what your desired output is. The measure i provided shows the customers with entries within 180 days (parameter value) of the EOM of the selected date.
Hi @NickolajJessen ,
I consider new customers to be those that haven’t purchased anything in the last 180 days (Parmeter).
Expected outcome based on my raw data.
New customer only 'NIKE' (1/1/2022) - No past purchased last 180 day
New customer list
LEEGASPKG (5/2/2022) - No past purchased last 180 day
PRIMANPET (2/2/2022) - No past purchased last 180 day
SABOXPKG (4/2/2022) - No past purchased last 180 day
SCCCPRKUL (5/2/2022) - Last purchased was 13/2/2021 , but already more than 180 days . So is consider new customer.
No new customer
New customer list
NIKE - No past purchased last 180 day (Differentiate by branches, even there have purchased on SIN branch ,Jan)
LEEGASPKG - No past purchased last 180 day
I hope I have clarified your doubts.
Thank you so much!
Ahh, we can just on my current path.
If it finds entries in the past 180 days, it should return blank, as it not counted as a new customer. If it doesn't find any entries in the past 180 we can do a countrows on the customer table. (Or a distinctcount, if we just want it to return 1)
I reuploaded the file and it produces your provided results:
https://drive.google.com/drive/folders/1AjePk7NUXAloXHr42BEa2lDOr5dQr2Wg
Hi @NickProp28 ,
Try replacing filter(all...) with
New Customers2 =
//Cus
VAR CustomerTM = VALUES( 'Customer'[Client] )
VAR PriorCustomer =
CALCULATETABLE(
VALUES( 'Customer'[Client] ),
ALLEXCEPT('Customer', 'Customer'[Branch]),
DATESINPERIOD('Customer'[ETD].[Date], MIN('Customer'[ETD]) - [Parameter Value], [Parameter Value],DAY)
)
RETURN
COUNTROWS( EXCEPT( CustomerTM, PriorCustomer ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
93 | |
83 | |
70 | |
65 |
User | Count |
---|---|
118 | |
106 | |
93 | |
79 | |
72 |