Let's say the Count/Distinct Count measure is based on filtered data.
When the situation allows, is it better to do a CASE statement with 1s and 0s from the table in the DSV and then do a SUM on this field Or is it better to create a new Named Query in the DSV filtering out the data through the WHERE clause based off of the original table and then do a DISTINCT COUNT measure on the newly created Named Query
If there's no clear cut answer as to what is the "better" approach, please offer up the advantages and disadvantages for both. My preference is best performance.
An Example:
Measure: Active SKU Count
Products dimension has product_key, SKU and Status
In the DSV for the Products dimension, should I add a CASE statement:
CASE WHEN [Status] = 'Active' THEN 1 ELSE 0 END AS [Active Status]
Then create a new SUM measure based on the Active Status column.OR
Create a new Named Query in the DSV:
SELECT * from Products WHERE Status = 'Active'
Then create a new DISTINCT COUNT measure based on the SKU column from the new Named Query