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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
monojchakrab
Resolver III
Resolver III

finding the lowest three values in a column

Hi PBI community,

While TOPN solves the problem for finding the top - 3,5, or 10, I could not find a function to do the opposite.

I came across this piece of code but not able to undertand the syntax in the last part, where "IN" is used with a series of numbers within curly brackets. 

Can someone help explain this last part of the code for me?

Really appreciate

Rank all rows as Column (CUSTID) =
RANKX(
FILTER(
'Table',
'Table'[CUSTID]=EARLIER('Table'[CUSTID])
),
'Table'[Your Value],,ASC,Dense
)


Then just return values ranked 1,2 and 3 by adding a new measure :

Lowest Values = CALCULATE([Value], 'Table'[Rank all rows as Column (CUSTID)] in {1,2,3})

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

The curly brackets are an expression to create a table. So {1, 2, 3} creates virtual table (since it´s in a measure) which looks like

table.jpg

 

 

 

 

 

 

 

The IN operator returns TRUE if a row value exists within a table.

So in the measure you posted, RANKX calculates the rank of the value in ascending order (so the lowest's rank will be 1, the second lowest 2 etc...)

So basically the [Lowest values] measure is calculating the values where the [RANKX] measure returns a value of 1, 2 or 3. (So the three lowest values)

Make sense?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

The curly brackets are an expression to create a table. So {1, 2, 3} creates virtual table (since it´s in a measure) which looks like

table.jpg

 

 

 

 

 

 

 

The IN operator returns TRUE if a row value exists within a table.

So in the measure you posted, RANKX calculates the rank of the value in ascending order (so the lowest's rank will be 1, the second lowest 2 etc...)

So basically the [Lowest values] measure is calculating the values where the [RANKX] measure returns a value of 1, 2 or 3. (So the three lowest values)

Make sense?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Excellent @PaulDBrown - crystal clear

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.