Forum Discussion
How to count rows with specific value in Power Query
- 2 years ago
Thanks Edhans.
I am creating this Row count column #"Added Custom 8" only after the custom column #"Added Custom 7" I created previously:
And I am creating the custom column from Add Column ribbon -> Custom Column and below is the code I have:
And when I click OK and run, getting the below error:
- 2 years ago
Text.Contains is wrong. It should be Text.Contains([Test], "No")
You have one argument with an equal sign. Get rid of that and replace with a comma, for 2 arguments.
Ok I changed it and it worked but the result is basically the entire row count in the table and not based on the condition we have to count only the rows with "No" value in TEST column. I want the same DAX output (116) in Power Query and not the entire table row count which is 8940
Any other way of writing this to get the intended result edhans?
You aren't sharing enough information. In my screenshots I am showing you the table and the answer. 17 records, 9 that match (in the second example). It isn't returning 17, the entire table record count. Showing two cards on the report with different values isn't helpful. What are those measures? Are you adding up, in my example, the 9 17 times and not just getting the distinct value?
How to get good help fast. Help us help you.
How To Ask A Technical Question If you Really Want An Answer
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.
- PowerUser392 years agoFrequent Visitor
edhans Thanks for the detailed explanation. I rebuilt the report again with the required columns alone with your approach and it worked.