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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

DAX: How to calculate number of occurences in a dataset

Hi,

 

I have a column with difference % values. I want to create a measure that will tell me how many of those values are greater than 50%. Can anyone advise how to do that?

 

Thanks,

NB1

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

When you get that error you have to include FILTER in the CALCULATE function.

You can still use @Zubair_Muhammad's measure, but you just need some adjustment:

 

Measure =
CALCULATE ( COUNTROWS ( TableName ), FILTER(TableName, TableName[column] > .5 ))

View solution in original post

Hello,

what is the current format of the column. Create a calculated column using "New Column = tablename[column). Please change the column to decimal or whole number. then you can use '
Measure =
CALCULATE ( COUNTROWS ( TableName ), TableName[column] > .5 )
as suggested by Zubair_Muhammad

View solution in original post

5 REPLIES 5

Hello,

what is the current format of the column. Create a calculated column using "New Column = tablename[column). Please change the column to decimal or whole number. then you can use '
Measure =
CALCULATE ( COUNTROWS ( TableName ), TableName[column] > .5 )
as suggested by Zubair_Muhammad
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try with following

 

Measure =
CALCULATE ( COUNTROWS ( TableName ), TableName[column] > .5 )
Anonymous
Not applicable

@Zubair_Muhammad thanks, however i'm still getting an error message: "A function CALCULATE has been used in a True/False expression that is used as a filter table expression. This is not allowed."

 

The column I want to filter by values that are >/< 50% is itself a calculated column. Does that change the DAX formula that needs to be used?

Anonymous
Not applicable

When you get that error you have to include FILTER in the CALCULATE function.

You can still use @Zubair_Muhammad's measure, but you just need some adjustment:

 

Measure =
CALCULATE ( COUNTROWS ( TableName ), FILTER(TableName, TableName[column] > .5 ))

@Anonymous

 

No it shouldn't matter if its a column or a calculated colum

 

Did you add the Formula as a MEASURE or calculated column

 

Could you show me the screen shot of your Table?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors