Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
dblain
Frequent Visitor

Calculate "New Accounts" - Sold Previous 30 Days/Unsold Previously

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
)

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @dblain,

 

If you need more help, please provide a sample.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TomMartens
Super User
Super User

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



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.