Reputation: 23
I have two tables (i.e. 1st is 'Sales' Table, 2nd is 'Territory' table) in my Power Pivot, and I have established relationships between the two using a 'territory' column.
The 'Sales' table contains Sales Orders data (i.e. Invoice id, date, territory, customer name, product, qty, rate, total, etc.).
The 'Cities' table contains Cities data such as territory, Area, Country.
QUESTION: How to write a DAX Calculated Measure in MS Excel Power Pivot to find total Distinct Count of territories that had no sale.
REASON: I want to know how many distinct territories in each month had no sale (meaning the territory(ies) which did not appear in the Sales data for any selected month) via Pivot Tables I have created in my dashboard.
Upvotes: 1
Views: 51
Reputation: 6009
You can create a new DAX measure from Power Pivot, Measures, New Measure, for example:
=CALCULATE(
DISTINCTCOUNT('Territory'[Territory]),
FILTER(
'Territory',
NOT (
'Territory'[Territory] IN
CALCULATETABLE(
VALUES('Sales'[Territory]),
'Sales'[Date] >= DATE(2024, 1, 1), -- Start Date (Adjust manually)
'Sales'[Date] <= DATE(2024, 3, 31) -- End Date (Adjust manually)
)
)
)
)
Create a new a Power Pivot and add whatever fields you need:
Upvotes: 0