Forum Discussion

dw700d's avatar
dw700d
Icon for Post Patron rankPost Patron
5 years ago
Solved

using a measure to filter specific items

I have a table with multiple purchase orders .Each purchase order has multiple account codes. I would like to create a measure that only shows purchase orders that contain specific account codes. For example in the data set below I would only like to see purchase orders  that contain account codeS DEF & WXY. As a result this table should only show Purchase Order 1, 3 & 5. Can anyone help me create a measure that accomplishes this?

 

Purchase OrderAccount Code
1ABC
1DEF
2ABC
2GHI
3DEF
4JKL
4MNO
5PQR
5STU
5WXY

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi dw700d ,

     

    Do you have a special purchase order list that you want to filter? The table is like

    Create the relationship as follows

     

    The filtered table is as follows. Account Code is from the main table and Purchase Order is from another table. Set the value of the purchase order in the filter is not blank.

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

     

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    dw700d you could create a filter measure such as below, and use it to filter a table visual.

    FilterMeasure = 
    IF(
        SELECTEDVALUE('Table (2)'[Account Code]) in {"DEF", "WXY"},
        1
    )

     

     

     

    • dw700d's avatar
      dw700d
      Icon for Post Patron rankPost Patron

      Anonymous  sorry I read you answer wrong. I see now that your approach would work. My challenge is I have over 1,000 purchase orders so putting each individual number in the measure would be difficult

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi dw700d ,

         

        Do you have a special purchase order list that you want to filter? The table is like

        Create the relationship as follows

         

        The filtered table is as follows. Account Code is from the main table and Purchase Order is from another table. Set the value of the purchase order in the filter is not blank.

         

         

         

        Best Regards,

        Stephen Tao

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

         

         

         

         

  • AnonymousThank you for your prompt response. I would like the ability to see all the account codes affiliated with Purchase orders 1,3 & 5 . currently your approach limits me to just viewing  DEF & WXY. For example  I would like the new table to like  below

     

    Purchase OrderAccount Code
    1ABC
    1DEF
    3DEF
    5PQR
    5STU
    5WXY
    • Anonymous's avatar
      Anonymous
      Not applicable

      dw700d I must be missing something, or just not following what you're trying to do.

      Can't you just alter the code like below?

      FilterMeasure = 
      IF(
          SELECTEDVALUE('Table (2)'[Purchase Order]) in {1, 3, 5},
          1
      )