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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.