Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have two tables as shown below. I want to validate and match the values from Product column of table 1 with Product column of Table 2 else it should return “Incorrect Value”.
Instead of creating a lookup table, can this be done through measure? Pls suggest the best option.
Table 1
Ref ID | Product | Category |
2349898729 | WW | Y |
2449898728 | WW | Y |
2549898727 | WW | O |
2649898726 | WW | O |
2749898725 | KK | Y |
2849898724 | KK | Y |
2949898723 | KK | Y |
3049898722 | KK | Y |
3149898721 | KK | W |
3249898720 | WW | E |
3349898719 | WW | E |
3449898718 | TT | R |
3549898717 | TT | R |
3649898716 | TT | R |
3749898715 | TT | R |
3849898714 | PP | M |
3949898713 | PP | M |
4049898712 | LK | N |
Table 2
Product | Category |
WW | Y |
WW | O |
KK | Y |
TT | R |
PP | M |
PP | N |
How the result should be displayed
Ref ID | Product | Category | Result |
2349898729 | WW | Y | Valid |
2449898728 | WW | Y | Valid |
2549898727 | WW | O | Valid |
2649898726 | WW | O | Valid |
2749898725 | KK | Y | Valid |
2849898724 | KK | Y | Valid |
2949898723 | KK | Y | Valid |
3049898722 | KK | Y | Valid |
3149898721 | KK | W | Valid |
3249898720 | WW | E | Valid |
3349898719 | WW | E | Valid |
3449898718 | TT | R | Valid |
3549898717 | TT | R | Valid |
3649898716 | TT | R | Valid |
3749898715 | TT | R | Valid |
3849898714 | PP | M | Valid |
3949898713 | PP | M | Valid |
4049898712 | LK | N | Incorrect Value |
Solved! Go to Solution.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
You can try
Measure =
var _sv = RIGHT(SELECTEDVALUE(Table1[Ref ID]),2)
VAR _LU = Calculate( FIRSTNONBLANK( Table 2[Category],0 ) , Table 2[Product] = _sv )
var _CV = Table1(ProductCategory)
RETURN
IF ( _LU = _SV, "Valid", "Incorrect Value" )
Did I answer your question? Mark my post as a solution! Proud to be a Super User!
Connect with me!
Stay up to date on
Read my blogs on
You can try
Measure =
var _sv = RIGHT(SELECTEDVALUE(Table1[Ref ID]),2)
VAR _LU = Calculate( FIRSTNONBLANK( Table 2[Category],0 ) , Table 2[Product] = _sv )
var _CV = Table1(ProductCategory)
RETURN
IF ( _LU = _SV, "Valid", "Incorrect Value" )
Did I answer your question? Mark my post as a solution! Proud to be a Super User!
Connect with me!
Stay up to date on
Read my blogs on
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |