Forum Discussion

holodan95's avatar
holodan95
Helper II
3 years ago
Solved

Show exceptions in table visual

Hello All,

 

I'm currently facing a problem with showing only those products that have no stock, or never been to a shop.

 

What I have:

Table 'A' - A table with the products, that need to be in a shop (all distinct)

Table 'B' - A table with all the stock data with: /date/shop/product/stock (many rows are duplicates which I cannot change)

 

In Table 'B', the SQL database automatically generates a row with 0 value, if a product that previously been to the shop is not in stock, however it doesn't, if said product have never been to a specific shop. If the product is in stock, it will generate a value accordingly.

 

From these two, I should be able to show only those products, that have 0 quantity in stock, or never been registered in the shop.

I can only establish a 1:Many relationship between table 'A' and 'B'

 

Example:

Table 'A'

 

Product nameProduct code
AAA

XXX0089

BBB

XXX0090

CCC

XXX0091

 

Table 'B'

DateShop codeProduct nameStock quantity
1S1AAA0
1S1BBB1
1S2AAA1
1S2BBB0
2S1AAA1
2S1BBB0
2S2AAA0
2S2BBB1

 

What I need is a visual table, that gives me back the following, whith these slicers:

Date: 2

Shop code: S2

 

The expected table:

Product nameStock
AAA0
CCC0

 

As you can see, I have product AAA with the 0 amount, and also CCC which has never been to the shop (it will not have a generated line in Table 'B')

 

Is there a way to make this happen? I could already make a table which shows all the products that have been to the shop, with the current stock amount, and on another, all the products possible. However I need the exact opposite. Products with NO value, or which were never in the shop.

 

Thanks for the help!

2 Replies