Forum Discussion
Lookup Value in two columns and return rows
Hi Everyone.
I need your help on this.
I have two table ( Item table and Sales Table). I have a slicer for item number("No") from the item table and a relationship between the two tables. The table are shown below.
Item Table
| No | Gen No | Desc 1 | Desc 2 |
| 1 | - | Dog | Black |
| 2 | 1 | Dog 2 | White |
| 3 | - | Dog 3 | Gold |
| 4 | 1 | Dog 4 | White and Black |
| 5 | - | Dog 5 | Spotted |
| 6 | 1 | Dog 6 | Brown |
Sales Table
| No | Gen No | Desc 1 | Desc 2 | Qty |
| 1 | - | Dog | Black | 4 |
| 2 | 1 | Dog 2 | White | 5 |
| 3 | - | Dog 3 | Gold | 8 |
| 4 | 1 | Dog 4 | White and Black | 6 |
| 5 | - | Dog 5 | Spotted | 2 |
| 6 | 1 | Dog 6 | Brown | 1 |
If i select "No" =1 from the slicer, i want to check on the sales table where the "No" =1 and also where the "Gen No" = 1 and i want to get the result table below
| No | Gen No | Desc 1 | Desc 2 | Qty |
| 1 | - | Dog | Black | 4 |
| 2 | 1 | Dog 2 | White | 5 |
| 4 | 1 | Dog 4 | White and Black | 6 |
| 6 | 1 | Dog 6 | Brown | 1 |
I hope i was descriptive enough.
5 Replies
- amitchandak
Super User
Try if this can solve
QTY_1 = calculate(sum(qty), filter(all(sales),sales[No]=allselected(sales[No]) || sales[Gen No]=allselected(sales[No])))Use QTY in your table.
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601- AnonymousNot applicable
Many thanks amitchandak .
However, the expression did not work. It showed "Cant display the visual" when i tried to use it.
- amitchandak
Super User
There is a link to see the error. what is the error it is giving