Row Filter Condition for Slice

Hi Guys

I have two tables for counting stock, STOCK COUNT and STOCK COUNT DETAILS. The stock count table creates a new entry every time out staff perform a stock count at a customer, the details table is linked to the stock count table but contains the specific count QTY for a given product. It is "Part Of" the STOCK COUNT table.

Given that some stores may have multiple stock counts taken, I want to create a Slice of the STOCK COUNT DETAILS  table that ONLY shows the results of the latest stock count taken for all stores -

** some stores may only have one count while some may have several, in which case I would want to show the stock count for the stores that only have one count, and then only the most recent count for the stores that have multiple.

My columns are as follows:

[ID]

[Ref ID] - reference ID to the STOCK COUNT table

[Brand] - brand counted

[QTY] - QTY of brand counted

[Count Date] - timestamp date for the count

[Company] - customer where the count was taken

 

I just can't wrap my head around the required logic here...

Solved Solved
0 10 659
1 ACCEPTED SOLUTION

Such a specific requirement over multi row expressions can be sync time expensive. Please try as below. 

1. Please create a VC called say [CompanyMaxDate] in the table "STOCK COUNT DETAILS" with an expression something like MAXROW("STOCK COUNT DETAILS", "Timestamp", [Company]=[_THISROW].[Company])

2. Then your slice expression can be 

[ID] = MAXROW("STOCK COUNT DETAILS", "Timestamp", AND([TimeStamp]=[CompanyMaxDate].[TimeStamp], [Company]=[_THISROW].[Company]))

 

View solution in original post

10 REPLIES 10