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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
XaviOV
Helper V
Helper V

Maximum value of a column filtered by other columns

Hi,

I have a table with these values and I need to filter the values with the example table (future), the result is column C

 

Actual:

1.png

 

Future:

 

2.png

Thanks!!

 

Xavi.

1 ACCEPTED SOLUTION
10 REPLIES 10
amitchandak
Super User
Super User

@XaviOV , a new column like

 

new column =
var _1 = countx(filter(Table, [ID_1] =earlier[ID_1] && [B] =0),[ID_1])+0
var _2 = MinX(filter(Table, [ID_1] =earlier[ID_1] ),[ID_0])
return
if([ID0] =_2 ,if(_1>0 0, 1),blank())

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak  ,

When I write the formula appear an error, I think that function earlier need something, it's possible?

 

Regards,

 

Xavi

@XaviOV , My mistake missing paranthesis 

 

new column =
var _1 = countx(filter(Table, Table[ID_1] =earlier(Table[ID_1]) && [B] =0),[ID_1])+0
var _2 = MinX(filter(Table, [ID_1] =earlier(Table[ID_1]) ),[ID_0])
return
if([ID0] =_2 ,if(_1>0 0, 1),blank())

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak 

I applied the formula that you write and this is the result, in this case in the file with the number of ID0 471635 and the row of new column should appear number 0

32112.png

 

Regards,

 

Xavi

Hi @amitchandak 

In the second IF beacause there are two 0?

 

Thanks!!

 

Xavi

@XaviOV ,Can you share sample data and sample output in table format? 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak 

ID0 is Whole number
ID1 is Text
A is Text
B is Whole number

 

Regards,

 

Xavi

 

Hi @amitchandak 

I try to paste the table from Excel but appear a error.

 

Regards,

 

Xavi

@XaviOV , Hope you got the solution on that blog. Thanks for sharing. 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.