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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
Microsoft Employee
Microsoft 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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.