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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NB1
Frequent Visitor

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

@NB1

 

Try with following

 

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

Regards
Zubair

Please try my custom visuals

@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 ))

@NB1

 

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?


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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