Skip to Content

Count along with match function in Webi

Hello Experts,
I have the below table in webi

and require the "count of occurance of IMP at the beginning of the Description field for each product", I should extract the below table.

I have tried using the variable "=Count(Match([Description]; "IMP*")) In ([Product])" but not as expected. Please help!

Thanks,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Dec 20, 2016 at 02:17 AM

    Re submitting the query as the tables were not clear

    Hello Experts,
    I have the below table in webi

    and require the "count of occurance of IMP at the beginning of the Description field for each product", I should extract the below table.

    I have tried using the variable "=Count(Match([Description]; "IMP*")) In ([Product])" but not as expected. Please help!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 20, 2016 at 09:48 AM

    Hello Vishal

    I guess, Count cannot be used over Match since it returns Boolean value. I tried like below .

    1. Imp-Matching= Match([Desc];"IMP*") It returning 1's & 0's.

    2. Create variable which converts the above variable to Number using Tonumber function; Imp-Match-Meas = ToNumber([Imp-Matching])

    3. count the matching using variable with = sum([Imp-Match-Meas]) foreach ([Product]).

    similarly use "Not" function in first variable to achieve non matching count.

    Hope it helps

    Regards

    Venkatesh

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 20, 2016 at 09:55 AM

    Your logic should work. Just instead of count use Sum(). See if that helps.

    =Sum(Match([Description]; "IMP*")) In ([Product])

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 20, 2016 at 11:52 AM

    I tried and it is working for me:

    [IMP Match]= Sum(Match([Description];"IMP*")) In ([Product])

    [IMP No Match] =Sum(If(Match([Description];"IMP*")=0) Then 1 Else 0) In ([Product])

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 26, 2016 at 08:50 AM

    Thank you Kuldeep, is working fine.

    Add comment
    10|10000 characters needed characters exceeded