Forum Discussion
SKU Distribution Trend?
- 4 years ago
This is only part of the complete measure
Matching Percent = VAR CurrentSKUs = VALUES ( 'SKU Distributions'[SKU] ) VAR PreviousSKUs = CALCULATETABLE ( VALUES ( 'SKU Distributions'[SKU] ), 'SKU Distributions'[Date Only] = MAX ( 'SKU Distributions'[Date Only] ) - 1 ) RETURN COUNTROWS ( INTERSECT ( PreviousSKUs, CurrentSKUs ) )
It depends. Let's say we're looking at day level, then we can retrieve the VALUES of the SKU's of the current date.
Suppose the dates are continuous (there are other solutions if not) then the previous date would be the current date - 1. We can use this date to CALCULATE the VALUES of SKU's of the previous date. Then simply we can DIVIDE the COUNTROWS of the INTERSECT between the two VALUES over the COUNTOWS of VALUES of the current date. Would that make sense to you?
Hi! Ok, this looks helpful but I'm still confused.
I created a summary table with the date and SKU of each. Now, for this formula, do I need to make a column so it iterates, or a measure?
To me, it seems like I'd do -
Or something like that to get the values of the date prior.
- tamerj14 years agoCommunity Champion
I hope by summary table you mean table visual. Then you can create a measure. To retrieve the table of previous SKU's you need to use CALCULATETABLE.
DATEADD might not work being time intelligence function therefore you can use
CALCULATETABLE(VALUES('SKU Distribution Table'[SKUs]),'SKU Distribution Table'[Date Only] = MAX('SKU Distribution Table'[Date Only]) -1)