1
Size: a a a
1
В
1
AL
В
1
ЮИ
И
VP
KK
KK
KK
И
И
VP
KK
KK
VP
И
Z
:=
VAR CustomersWithNewDate =
CALCULATETABLE ( -- Prepares a table that
ADDCOLUMNS ( -- for each customer contains
VALUES ( Sales[CustomerKey] ), -- the date of their first puchase
"@NewCustomerDate", [Date New Customer]
),
ALLEXCEPT ( Sales, Customer )
)
VAR NewCustomers =
FILTER (
CustomersWithNewDate, -- Filters the customers
[@NewCustomerDate] -- whose new customer date
IN VALUES ( 'Date'[Date] ) -- falls within the current period
)
VAR Result = -- The count of the new customers
COUNTROWS ( NewCustomers ) -- does not use the Sales table
RETURN
Result
Sales New Customers :=
VAR CustomersWithNewDate =
CALCULATETABLE ( -- Prepares a table that
ADDCOLUMNS ( -- for each customer contains
VALUES ( Sales[CustomerKey] ), -- the date of their first puchase
"@NewCustomerDate", [Date New Customer]
),
ALLEXCEPT ( Sales, Customer )
)
VAR NewCustomers =
FILTER (
CustomersWithNewDate, -- Filters the customers
[@NewCustomerDate] -- whose new customer date
IN VALUES ( 'Date'[Date] ) -- falls within the current period
)
VAR Result = -- The count of the new customers
CALCULATE (
[Sales Amount], -- Computes the Sales Amount measure
KEEPFILTERS ( NewCustomers ) -- by applying the filter for new customers
) -- does not use the Sales table
RETURN
Result