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
Ozcoz
Frequent Visitor

Total times a value appears in a column

My apologies for this very simple question.

 

I'm wanting to simply know how many times the number 7 appears in the STATUS_ID column.  With the formula I currently have, the result is 'FALSE'.  I've tried SUM, COUNT etc, I'm not sure which one to use.

 

The formula I currently have is:

RFMO endorsed total = calculate(count(PB_PRESCRIBED_BURNS[STATUS_ID])="7"+0)

 

Thanks.

1 ACCEPTED SOLUTION

Please try to use below measure:

Measure = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Values] = 7))

Thanks.

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
AiolosZhao
Memorable Member
Memorable Member

Hi @Ozcoz ,

 

Please try to use below measure:

test = CALCULATE(COUNTROWS(VALUES(your column)),FILTER(your table,your column = 7))

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for the reply.  This is a huge step further than where I was at, however it is only returning a value of 1 or blank.  I'm not getting a tally.  There are 5 records with '7' as the status ID in the database but it only says 1 on a card with this measure.

 

My formula looks like this:

RFMO endorsed total = CALCULATE(COUNTROWS(VALUES(PB_PRESCRIBED_BURNS[STATUS_ID])),FILTER(PB_PRESCRIBED_BURNS,PB_PRESCRIBED_BURNS[STATUS_ID] = 7))

Please try to use below measure:

Measure = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Values] = 7))

Thanks.

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for the solution on this one @AiolosZhao 

 

Further to this, what would the DAX code be to choose multiple slections from the same row?   

 

For example, I want to know the total number of times 7 and 11 appears in the column.

Please try below:

 

Measure = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Values] in {7,11}))

or

Measure = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Values] = 7 || Table1[Values] = 11))

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.