Forum Discussion
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 Order | Account Code |
| 1 | ABC |
| 1 | DEF |
| 2 | ABC |
| 2 | GHI |
| 3 | DEF |
| 4 | JKL |
| 4 | MNO |
| 5 | PQR |
| 5 | STU |
| 5 | WXY |
- Anonymous5 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
- AnonymousNot 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
Post 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
- AnonymousNot 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.
- dw700d
Post Patron
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 Order Account Code 1 ABC 1 DEF 3 DEF 5 PQR 5 STU 5 WXY - AnonymousNot 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 )