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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Need some help on writing a measure to count numbers of bars.

Hi I am still new to DAX and I feel like it should be an easy DAX to write but I tried and couldn't figure it out.
I have a chart below, I want to have a measure that counts the number of bars that is below the target, these two green bars, in this case, it should retunrs "2" as the result. 

Thanks!!

bwang2_0-1717093805428.png

 

1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @Anonymous 

 

I'm not sure where you got your target so I hard coded it to be 8.

 

These measures should help.

Target = 8

Shifts = SUM( 'Table'[# of Shifts] )

Below = 
    COUNTROWS(
        FILTER(
            'Table',
            [Shifts] <= [Target]
        )
    )

 

Let me know if you have any questions.

 

bwang2.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

1 REPLY 1
gmsamborn
Super User
Super User

Hi @Anonymous 

 

I'm not sure where you got your target so I hard coded it to be 8.

 

These measures should help.

Target = 8

Shifts = SUM( 'Table'[# of Shifts] )

Below = 
    COUNTROWS(
        FILTER(
            'Table',
            [Shifts] <= [Target]
        )
    )

 

Let me know if you have any questions.

 

bwang2.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.