Forum Discussion
Need to Get Table.ColumnCount if column contains specific value
- 1 year ago
Hi Anonymous You have provided wrong information and desired output. However, to count rows which contain specific word, try below steps:
AddCountColumn = Table.AddColumn(PreviousSteps, "DifferentCount", each try if Table.HasColumns([Sheets], "Column Name") then Table.RowCount(Table.SelectRows([Sheets], each Text.Contains([Column Name], "Different"))) else 0 otherwise 0)Change column name accordingly.
[Sheets] column will contain your table and the column name from which you want to count rows which contains specific word, for your case "DIFFERENT".
For my case, I have used Customer Name column from table. Each table contain this column, if not then will return 0.
Hope this will solve your problem!!
Hi Anonymous - Use Table.SelectRows to filter rows in each sheet where any column contains "Different".
This will create a new column, "Count Columns with 'Different'," that contains the count of columns with the value "DIFFERENT" for each table in your dataset.
attached mcode FYR
Hello rajendraongole1
Thankyou for your Valuable Solution,
I tried it and it provides Value 0.
I need Count of column which contains value "DIFFERENT" can you share little more insight ?