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 August 31st. Request your voucher.

Reply
aolan
Frequent Visitor

Count rows that are less than the current row's value

Hi,

 

I have a set of values from a calculated measure that represents the scores from a test - it counts the number of "Correct" marks. I basically want to count the rows of the values less than the current row value. Note that the scores can appear multiple times.

 

An example of what I am trying to achieve is below...

 

Screenshot_1.png

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Hi,

Thank you for your feedback.

Could you please try the below?

 

Expected count result measure: =
VAR _a = [PRE_TotalNumeracy measure]
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'TableName'[Name] ),
        FILTER ( ALL ( 'TableName'[Name] ), [PRE_TotalNumeracy measure] < _a )
    )

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but could you please try something like below wether it suits your requirement?

 

Expected count result measure: =
VAR _a = [PRE_TotalNumeracy measure]
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'TableName'[ColumnName] ),
        [PRE_TotalNumeracy measure] < _a
    )

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

I have a "People" table that filters 1..* the "Responses" table. The Responses table looks something like...

 

NameQuestion NumberMarkBit
ABCQuestion 1Correct1
ABCQuestion 2Correct1
ABCQuestion 3Incorrect0
ABCQuestion 4Correct1

 

And the score is an aggregate of the "Bit" column. I feel like your answer is almost there but I am just getting this error: A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

Hi,

Thank you for your feedback.

Could you please try the below?

 

Expected count result measure: =
VAR _a = [PRE_TotalNumeracy measure]
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'TableName'[Name] ),
        FILTER ( ALL ( 'TableName'[Name] ), [PRE_TotalNumeracy measure] < _a )
    )

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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