Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Find lowest value in two tables by ID

I'm having trouble getting a good results here for either a measure or a new calculated table. I have two joined tables with ID and priority fields. The first table will ahve multiple values for the same ID and the other table will have one. I need to look across both tables and then return the lowest value by ID. I don't care whether it's a new table or measure to get the result. Example below:

 

Table1:

ID              Priority

1231
1232
1233
4563
4563
4564

 

Table2:

ID             Priority

1234
4562

 

Desired Result:

ID              Priority

1231
4562
1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Other solutions.

1. Add a calculated column in Table 2.

Column =
MIN ( CALCULATE ( MIN ( 'Table1'[Priority] ) ), [Prority] )

2. A measure with the 'Table 2'[ID] in a Table visual.

Measure =
MIN ( MIN ( 'Table1'[Priority] ), MIN ( 'Table2'[Prority] ) )

Find-lowest-value-in-two-tables-by-ID

 

 

Best Regards,
Dale

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

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

 

Using the Query Editor, append data from both tables to create a new table.  Now in your visual, drag the ID and write this measure

 

=MIN(Data[Priority])

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable


@Ashish_Mathur wrote:

 

Using the Query Editor, append data from both tables to create a new table.  Now in your visual, drag the ID and write this measure

 

=MIN(Data[Priority])

 


Might be easier with this rational to do 

Measure =
        CALCULATE ( MINX ( UNION ( Table1, Table2 ), [Priority] ) )

Hi,

 

A calculate function should not be required in your formula.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

You're right, it's implicit.

v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Other solutions.

1. Add a calculated column in Table 2.

Column =
MIN ( CALCULATE ( MIN ( 'Table1'[Priority] ) ), [Prority] )

2. A measure with the 'Table 2'[ID] in a Table visual.

Measure =
MIN ( MIN ( 'Table1'[Priority] ), MIN ( 'Table2'[Prority] ) )

Find-lowest-value-in-two-tables-by-ID

 

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks Dale!

LivioLanzo
Solution Sage
Solution Sage

As a calculated table, you can do it like this:

 

Table = 
GROUPBY(
    UNION( Table1, Table2 ),
    Table1[ID], 
    "Priority", MINX( CURRENTGROUP(), [Priority] )
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.