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 August 31st. Request your voucher.
I am trying to calculate the total number of distinct new accounts. The logic I am wanting to use is the following:
- Sales > 0 in the last 30 days for each specific account
- Sales <= 0 in all days prior for each specific account
I am unable to wrap my head around how make this logic apply to each unique Account ID. Below is the measure i am currently using. This may be totally off track, but even if it is the correct direction I am still missing the account logic within each VAR.
For reference:
[Quantity 9 L] = Sales
[CleansedOutletKey] = Unique Account ID
New Account =
Var Sales_30_Days = sumx(
Filter('VIPReport Depletion Detail',
RELATED('report Date'[Relative Day]) <= 30
)
,
'VIPReport Depletion Detail'[Quantity 9 L])
Var Sales_30_Days_Prior = sumx(
Filter('VIPReport Depletion Detail',
RELATED('report Date'[Relative Day]) > 30
)
,
'VIPReport Depletion Detail'[Quantity 9 L])
return if(and(
Sales_30_Days > 0,
Sales_30_Days_Prior <= 0
)
,
DISTINCTCOUNT('VIPReport Depletion Detail'[CleansedOutletKey]),
0
)
Hi @dblain,
If you need more help, please provide a sample.
Best Regards,
Dale
Hey,
without more information about your data model, it's difficult to provide guidance just by looking at your DAX statement.
Maybe you are not aware of this blog post by Chris Webb about Returning Customer, but it also provides insight how to create a DAX statement that counts new customer:
https://blog.crossjoin.co.uk/2010/05/03/counting-returning-customers-in-dax/
Regards
Tom
User | Count |
---|---|
77 | |
76 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
79 | |
57 | |
48 | |
48 |