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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. 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
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.