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 ) )
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)
I'm getting this error -
Here is a screenshot of my table -
- tamerj14 years agoCommunity Champion
You have added a column. Go back to the query editor and send some screenshots. It should not a problem to fix it.
- tamerj14 years agoCommunity Champion
Sorry I got distracted by something else.
What is the code you have used. Can you please share? It is a measure orca calculated column?
- Thigs4 years agoHelper IV
No worries, thank you SO much for your help!
Matching Percent = CALCULATETABLE(VALUES('SKU Distributions'[SKU]),'SKU Distributions'[Date Only] = MAX('SKU Distributions'[Date Only]) -1)
SKU is simply a list of SKUs. Date Only is a list of dates (with the time stamp removed). Should it be a calculated column? I figured it was a measure since each row in the table is not one date - each row is a date + a sku.- tamerj14 years agoCommunity Champion
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 ) )