Prompt
NewCustomers =
COUNTX(
EXCEPT( AllCustomersPerMonth[Customers], PreviousCustomers[Customers]),
[Customers]
)
Answer
Sure, let's break down the code snippet you provided.
NewCustomers =
COUNTX(
EXCEPT(AllCustomersPerMonth[Customers], PreviousCustomers[Customers]),
[Customers]
)
DAX Functions Used:
There are two main DAX (Data Analysis Expressions) functions used:
COUNTX
: A DAX statistical function that counts the number of rows of data in a column, where the values in each row are evaluated by their expression or measure.EXCEPT
: A DAX function that returns the rows of a table that are present in the first table parameter and not present in the second table parameter.
Explanation:
The overall aim of this code is to calculate the number of new customers, i.e., customers that are in 'AllCustomersPerMonth' but not in 'PreviousCustomers'.
EXCEPT(AllCustomersPerMonth[Customers], PreviousCustomers[Customers])
:This part is using the
EXCEPT
function to find out the customers that are present in 'AllCustomersPerMonth' but not present in 'PreviousCustomers'. So basically, it's isolating the "new" customers.COUNTX([...], [Customers])
:The
COUNTX
function then counts the number of these new customers. It goes through the result of theEXCEPT
function (a table of new customers) and counts the number of unique [Customers].
Conclusion:
The variable NewCustomers
will thus hold the count of new customers that haven't made purchases in previous months but did in the current month. This type of calculation is valuable in business analyses for understanding customer growth and acquisition.
Also for further knowledge on DAX formulas and how to use them, Enterprise DNA Platform offers several in-depth courses which you may find beneficial. These courses provide a comprehensive understanding of how DAX functions work and how they can be applied to solve complex problems.
Description
The given code snippet calculates the number of new customers acquired in the current month. It utilizes DAX functions to isolate the customers present in 'AllCustomersPerMonth' but not in 'PreviousCustomers'. The 'EXCEPT' function is used to find the new customers, and then the 'COUNTX' function counts the number of these new customers. This calculation is useful for tracking customer growth and acquisition in business analyses. For a deeper understanding of DAX functions and their application, the Enterprise DNA Platform offers comprehensive courses on DAX formulas.