Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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 

NoGen NoDesc 1Desc 2
1-DogBlack
21Dog 2White
3-Dog 3Gold
41Dog 4White and Black
5-Dog 5Spotted 
61Dog 6Brown
    

 

Sales Table 

NoGen NoDesc 1Desc 2Qty
1-DogBlack4
21Dog 2White5
3-Dog 3Gold8
41Dog 4White and Black6
5-Dog 5Spotted 2
61Dog 6Brown1

 

 

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

 

NoGen NoDesc 1Desc 2Qty
1-DogBlack4
21Dog 2White5
41Dog 4White and Black6
61Dog 6Brown1

 

I hope i was descriptive enough.

 

 

5 Replies

  • 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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Many thanks amitchandak . 

      However, the expression did not work. It showed "Cant display the visual" when i tried to use it. 

       

       

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        There is a link to see the error. what is the error it is giving