VP
Size: a a a
VP
1
ДВ
VP
1
VP
1
VP
VP
VH
VH
VP
KK
VH
В
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
1
В
1