Forum Discussion
Counting text in column
Hi everyone
I've created the following measure to count the number of rows when specific columns are filtered, but it's not working. All columns are formatted as text (as I need to retain leading zeros) and I have tried COUNTROWS(), COUNTA() and COUNTAX(), but no joy. Any ideas greatly appreciated? 😊
Hi gth ,
It is really helpful to answer if you could share sample data in text format with expected output. In the meantime you can try any of these code:-
5. in high-skilled employment 2017/1 = COUNTROWS ( FILTER ( all_core_data, all_core_data[XWRKHSKILL] IN { "01" } && all_core_data[XACTIVITY] IN { "01", "02", "03", "04", "05" } && all_core_data[year] = "2017/18" ) )or
5. in high-skilled employment 2017/1 = CALCULATE ( COUNT (all_core_data[HUSID]), FILTER ( all_core_data, all_core_data[XWRKHSKILL] IN { "01" } && all_core_data[XACTIVITY] IN { "01", "02", "03", "04", "05" } && all_core_data[year] = "2017/18" ) )Thanks,
Samarth
6 Replies
- Samarth_18Community Champion
Hi gth ,
It is really helpful to answer if you could share sample data in text format with expected output. In the meantime you can try any of these code:-
5. in high-skilled employment 2017/1 = COUNTROWS ( FILTER ( all_core_data, all_core_data[XWRKHSKILL] IN { "01" } && all_core_data[XACTIVITY] IN { "01", "02", "03", "04", "05" } && all_core_data[year] = "2017/18" ) )or
5. in high-skilled employment 2017/1 = CALCULATE ( COUNT (all_core_data[HUSID]), FILTER ( all_core_data, all_core_data[XWRKHSKILL] IN { "01" } && all_core_data[XACTIVITY] IN { "01", "02", "03", "04", "05" } && all_core_data[year] = "2017/18" ) )Thanks,
Samarth
- gthNew Member
Hi Samarth_18
Thanks so much for your reply and for your suggestions. I'll try and provide some sample data - apologies for not doing that initially...am very new to all this.
Thanks again
- v-angzheng-msftCommunity Support
Hi, gth
May I ask if your problem has been solved? Is the above post helpful to you?
If it does, could you please mark the post which help as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.
It makes it easier to give you a solution.
- Sample (dummy dataset) data as text, use the table tool in the editing bar
- Expected output from sample data
- Explanation in words of how to get from 1. to 2.
Best Regards,
Community Support Team _ Zeon ZhengIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- gthNew Member
Hi. Apologies for not doing that sooner...and thank you too for the useful advice - I'll remember that for next time. Thanks again