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
gth
New Member

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? 😊

 

5. in high-skilled employment 2017/18 =
CALCULATE (
COUNT (all_core_data[HUSID]),
( all_core_data[XWRKHSKILL] IN { "01" } ),
all_core_data[XACTIVITY] in {"01","02","03","04","05"},
all_core_data[year] = "2017/18"
)
1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community 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

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

6 REPLIES 6
v-angzheng-msft
Community Support
Community 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.

  1. Sample (dummy dataset) data as text, use the table tool in the editing bar
  2. Expected output from sample data
  3. Explanation in words of how to get from 1. to 2.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi. Apologies for not doing that sooner...and thank you too for the useful advice - I'll remember that for next time. Thanks again

Samarth_18
Community Champion
Community 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

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

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

selimovd
Super User
Super User

Hey @gth ,

 

th approach doesn't look wrong to me. But it's hard to say why it doesn't work without more information.

Can you share the file or create a sample file? That would make it easier to understand why it's not working in your case.

 

Best regards
Denis 

Hey @selimovd 

Thanks so much for your reply. I'll try and provide some sample data - apologies for not doing that initially...am very new to all this.

Thanks again

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.