I have four tables which I have tried related and unrelated:
- Store (column "Store Number")
- Calendar (column "Sales Date")
- SKU (column "SKU Code")
- Sales (columns "Store Number", "Sales Date", "SKU Code" and "Sales Quantity")
I have slicers on the Calendar and SKU tables
I need to list all stores with total "Sales Quantity"
for each store and at the same time to limit the sales quantity to the two slicers mentioned above. Basically, I need to list these columns:
- Store Number - from the Store table (no filtering from Slicers)
- Store Name - from the Store table (no filtering from Slicers)
- Total Quantity of Sales for the Store - calculated measure filtered by Calendar and SKU slicers
So my question is, what DAX required to create the calculated measure?
Please note I must list ALL stores regardless of whether they have sales in the stipulated period.
I've tried various DAX functions such as TREATAS
, SUMMARIZE
, ETC.
I've tried with and without active relationships and with no relationships.
The closest I've got is the code below, but it excludes stores with zero sales. I need all stores regardless of their sales.
Qty by Store = CALCULATE(
sum(Sales[Sales Qty])
,USERELATIONSHIP(
Sales[Store Number]
,Store[Store Number]
)
)
The problem with the output I've managed is that stores without sales are excluded from the list. I need to have them included.