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.
Hi
I have 2 tables as follow. I want to lookup and bring the contact_compay name (output is in blue) in tables one based on order_group_id and the lowest order_id in the relevant order_group.
For example for order_group_id 1, there are 3 {1, 2, 3} order_ids. But we need to lookup the value for the lowest order_id, that is 1 and the value would be the ABC
Table 1
order_group_id | Order_id | Lookup Values (Contact Company) |
1 | 1 | ABC |
1 | 2 | ABC |
1 | 3 | ABC |
2 | 4 | JKL |
2 | 5 | JKL |
2 | 6 | JKL |
Table 2
order_group_id | order_id | orderline_id | contact_company |
1 | 1 | 1 | ABC |
1 | 1 | 2 | ABC |
1 | 2 | 1 | DEF |
1 | 2 | 2 | DEF |
1 | 2 | 3 | DEF |
1 | 3 | 1 | GHI |
2 | 4 | 1 | JKL |
2 | 4 | 2 | JKL |
2 | 5 | 3 | LMN |
Thank you so much for all your help.
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Contact company CC =
VAR currentordergroup = Table1[order_group_id]
VAR _filterTable2 =
FILTER ( Table2, Table2[order_group_id] = currentordergroup )
VAR _minorderid =
MINX ( _filterTable2, Table2[order_id] )
VAR _minorderidtable =
SUMMARIZE (
FILTER (
Table2,
Table2[order_group_id] = currentordergroup
&& Table2[order_id] = _minorderid
),
Table2[contact_company]
)
RETURN
IF ( COUNTROWS ( _minorderidtable ) = 1, _minorderidtable )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Please check the below picture and the attached pbix file.
Contact company CC =
VAR currentordergroup = Table1[order_group_id]
VAR _filterTable2 =
FILTER ( Table2, Table2[order_group_id] = currentordergroup )
VAR _minorderid =
MINX ( _filterTable2, Table2[order_id] )
VAR _minorderidtable =
SUMMARIZE (
FILTER (
Table2,
Table2[order_group_id] = currentordergroup
&& Table2[order_id] = _minorderid
),
Table2[contact_company]
)
RETURN
IF ( COUNTROWS ( _minorderidtable ) = 1, _minorderidtable )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@rashidanwar , a new column
new column =
var _1 = minx(allselected(table1), table1[order_group_id] = earlier(Table[order_group_id])), [Order_id])
return
maxx(filter(Table2, Table2[order_group_id] = Table1[order_group_id] && Table2[Order_id]=_1), [contact_company])
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 |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
146 | |
110 | |
107 | |
86 | |
63 |