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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Saxon10
Post Prodigy
Post Prodigy

Index and MIN value based on the two tables

Hi,

I have two tables are data and report.
"The data table contains the 'Area' and 'Priority' columns.
The Report table contains columns such as 'Item,' 'Area,' and 'Priority'.
If an item has multiple priorities or areas, I aim to retrieve the minimum priority value within that area. When a code has a unique priority, I will return that same value.
Example:
Item 3663 exhibits multiple priorities and areas, namely DEL, CHE, and LKN, with priorities of 3, 2, and 7, respectively. As a result, the selected area is CHE.
Similarly, for Item 166, having multiple priorities and areas (CHE and RCB) with priorities 2 and 6, the chosen area is CHE. Additionally, Item 489 features multiple priorities and areas (DEL and GT) with priorities 3 and 8; consequently, the selected area is DEL. For all other items, since they possess a unique value, the same value is returned."

I currently utilize a specific Excel formula "=INDEX($I$2:$I$11,MIN(MATCH(FILTER($B$2:$B$13,$A$2:$A$13=$A2),$I$2:$I$11,0)))" to obtain the desired outcome. How can I replicate the same process in Power BI using DAX within the 'New calculated column.

Saxon10_1-1698879582283.png

Report:

ItemAreaPriorityDesired Result-1
166CHE2CHE
166RCB6CHE
489DEL3DEL
489GT8DEL
540CHE2CHE
541CHE2CHE
3519LKN7LKN
3663RCB6CHE
3663DEL3CHE
3663CHE2CHE
3663LKN7CHE
3815LKN7LKN


Data:

PriorityArea
1MI
2CHE
3DEL
4SRH
5KKR
6RCB
7LKN
8GT
9KPJ
10RR


Excel and PBI attached for your reference.

https://www.dropbox.com/scl/fi/aze3qy5bndkwm1wiax4xr/example_1.xlsx?rlkey=agpici6e753nkycjrs8d9c0ko&...

https://www.dropbox.com/scl/fi/er15yl2ogse657zbslc06/ZC.pbix?rlkey=2ng91fmcrxb6meycrw6w3trkj&dl=0

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This problem can be solved without the second table.  Use these calculated column formulas

Minimum priority number = CALCULATE(MIN(REPORT[Priority]),FILTER(REPORT,REPORT[Item]=EARLIER(REPORT[Item])))
Area of minimum priority = CALCULATE(MAX(REPORT[Area]),FILTER(REPORT,REPORT[Item]=EARLIER(REPORT[Item])&&REPORT[Priority]=EARLIER(REPORT[Minimum priority number])))

Hope this helps.

Ashish_Mathur_0-1698883154376.png

 


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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This problem can be solved without the second table.  Use these calculated column formulas

Minimum priority number = CALCULATE(MIN(REPORT[Priority]),FILTER(REPORT,REPORT[Item]=EARLIER(REPORT[Item])))
Area of minimum priority = CALCULATE(MAX(REPORT[Area]),FILTER(REPORT,REPORT[Item]=EARLIER(REPORT[Item])&&REPORT[Priority]=EARLIER(REPORT[Minimum priority number])))

Hope this helps.

Ashish_Mathur_0-1698883154376.png

 


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

Thanks for your reply and support.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors