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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Del235
Helper III
Helper III

Count not calculating correctly

I am trying to count text in a column but I'm getting incorrect values.  Example:  I have two columns 

 

Visit Date AttendancePromoter-Detractor
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Detractor
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Neutral
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter
7/9/2023 0:00Promoter

 

When I use the formula:

 

Count of Promoter-Detractor for Promoter =
CALCULATE(
    COUNTA('CUSTOMER_FEEDBACK_TABLE'[Promoter-Detractor]),
    'CUSTOMER_FEEDBACK_TABLE'[Promoter-Detractor] IN { "Promoter" }
)
 
I get a count of 23 for Promoter when it should be 11.  Why?
19 REPLIES 19
Del235
Helper III
Helper III

Is my issue related to the fact that I'm trying to get the count by Date?

Anonymous
Not applicable

Yes, if you're simply looking for a count of rows where the "Promoter-Detractor" has a value of "Promoter" only, use the forumla shared and it will work just fine. You want to filter off of that column, not the date column. 

So there are other dates.  So I would be counting the number of "Promoters" by date in the column Promotor-Detractor.

Anonymous
Not applicable

It would be the same measure/formula. You would just use your date field in your visual or table as a column or x-axis. For this example, I used the same data you shared but changed a couple of the dates so that you can see the break of the count measure among dates. 

 

Notice I used the same measure I shared, but now I pulled in the date column. This counts the number of "Promoter"s by date.

 

wegemmell_0-1692739104410.png

 

Anonymous
Not applicable

@Del235 Did this resolve your issue?

No.  Something else is going on.  Even if I do a count on the column Promoter-Detractor I dont get the same answer as I would if I export the data into excel.

If I export the Data Table to Excel, then import it into power bi, I get different results.  See below:

PBI.JPG

The one on the left is correct.  Both tables have the the column Promotor-Detractor as text.  Why the different results?

Anonymous
Not applicable

Will you share a copy of the example pbix file you're working with?

It has PII info in it, and I'm using DirectQuery.  I'll see if I can do it another way.

 

Anonymous
Not applicable

Just a generic copy with sample data is perfect. I can always create one as well and send it over. 

Anonymous
Not applicable

So...

We store data on Snowflake.  I am connecting Power BI to Snowflake and use DirectQuery to connect to it.  Today I downloaded the data from snowflake and opened in Excel.  It ma

 

tches the totals I get in Power BI.  BUT...  The example I used was from a table I created in PBI using all of the columns with no filters.  That was the example I used above.  Turns out the Original formula I used was correct because it is seeing all of the data.  The export of the table is missing data but there are no filters (I Swear).  So there isn't a formula problem but why isn't all of the data appearing.

 

See the data below:

 

Snowflake PBI-Export
DatePromoter-Detractor DatePromoter-Detractor
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Detractor
7/9/2023Neutral 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Neutral
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter 7/9/2023Promoter
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Neutral   
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Detractor   
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Promoter   
7/9/2023Promoter  

 

    

 

 There are no filters but I can't figure out why the other rows don't appear but the formula counting the rows sees them and counts them.

Anonymous
Not applicable

Right... a couple of things here. It does sound like either formula will work. If the data you are exporting to Excel via a visual is over a certain number of rows, that is why. Power BI has a row limit for exporting. There are ways around this. I use a combination of Azure data studio and Excel to get mass amounts of data from Power BI. Raw data wise, you can try copying the loaded table from the Table view mode of Power BI (right click table name, copy) and paste it into Excel. This can be quite taxing depending on the amount of data, however. 

Its only 2400 rows

 

If I open the table in Power Query I see all 2400 rows...

 

Anonymous
Not applicable

If you're in Power Query that's just a preview of the data. Load it into your model and look at the table of data in the Table view mode in model view. 

Del235
Helper III
Helper III

Same result

 

Anonymous
Not applicable

You're using a DAX measure? That tested successfully for me...

 

Count of Promoter-Detractor for Promoter = 
COUNTROWS(
    FILTER('CUSTOMER_FEEDBACK_TABLE',
    'CUSTOMER_FEEDBACK_TABLE'[Promoter-Detractor] = "Promoter"
    )
)

 

wegemmell_0-1692736429674.png

 

 

Anonymous
Not applicable

Try this one out:

 

Count of Promoter-Detractor for Promoter =
COUNTROWS(
    FILTER('CUSTOMER_FEEDBACK_TABLE',
    'CUSTOMER_FEEDBACK_TABLE'[Promoter-Detractor] = "Promoter"
    )
)

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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