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
kirkjordan
New Member

countrows range measure

Hi all,

 

New to this so please excuse the ignorance. Trying to create a measurement to count the number of values in the ordervalue column between 2 values for example count the number of rows between £0 - £500, £501 - £1000, £1001 – £2000 and so on. Still new to PBI so the less complicated the better

 

Regards,

 

kirkjordan_0-1611581060447.png

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @kirkjordan 

1. Create an ancillary table Thresholds (no relationships) describing the ranges:

Range MinVal MaxVal
0-500 0 500
500-1000 500 1000
1000-2000 1000 2000

make sure MinVal and MaxVal are of type number 

2. Place Thresholds[Range] in a table visual

3. Place this measure in the visual

Measure =
VAR minVal_ = SELECTEDVALUE ( Thresholds[MinVal] )
VAR maxVal_ = SELECTEDVALUE ( Thresholds[MaxVal] )
RETURN
    COUNTROWS (
        FILTER ( Table1, Table1[ordervalue] >= minVal_ && Table1[ordervalue] < maxVal_ )
    )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

4 REPLIES 4
AlB
Community Champion
Community Champion

@kirkjordan 

Can you share the pbix? Or one with dummy data that reproduces the problem?

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Got it working, thanks for your help!!!

kirkjordan
New Member

Hi @AlB 

 

Not sure if I did that correctly, getting an error

 

PBI 1.png

 

 

AlB
Community Champion
Community Champion

Hi @kirkjordan 

1. Create an ancillary table Thresholds (no relationships) describing the ranges:

Range MinVal MaxVal
0-500 0 500
500-1000 500 1000
1000-2000 1000 2000

make sure MinVal and MaxVal are of type number 

2. Place Thresholds[Range] in a table visual

3. Place this measure in the visual

Measure =
VAR minVal_ = SELECTEDVALUE ( Thresholds[MinVal] )
VAR maxVal_ = SELECTEDVALUE ( Thresholds[MaxVal] )
RETURN
    COUNTROWS (
        FILTER ( Table1, Table1[ordervalue] >= minVal_ && Table1[ordervalue] < maxVal_ )
    )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

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.