Forum Discussion

megwpost's avatar
megwpost
New Member
6 years ago
Solved

trying to count a string is difficult

I currently am trying to better group open text columns.  my example here is that I first want to group and count any that contain the string "Win 10".  This should be fairly simple to do (it is in SQL) but nothing seems to work in DAX.

 

 
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi megwpost ,

    You can create a calculated column as below and put the new column onto the visual (its total value is the number of strings containing Win 10).

     

    IsexistWin10 = 
    VAR _exist =
        IFERROR ( SEARCH ( "Win 10", 'Document'[CoS_ShortSummary] ), 0 )
    RETURN
        IF ( _exist > 0, 1, 0 )

     

    Best Regards

    Rena

3 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    I can start you off.

    Add a column with DAX like

    ColumnA = FIND("Win 10", Table[Column],,0)
     
    sub in the table and column names
  • megwpost ,

    For grouping , use the ALLEXCEPT(TableName,GroupCOlumnName).

    Measure Group = CALCULATE(COUNTROWS(Sheet4),ALLEXCEPT(Sheet4,Sheet4[ShortSummary]))
    And also, for Win10  string You can sue FIND/SEARCH/CONTAINS DAX for this.
    Measure Count =  CALCULATE(COUNT(Sheet4[ShortSummary]),FILTER(Sheet4,CONTAINS(Sheet4,Sheet4[ShortSummary],"Win10")))
     
     
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi megwpost ,

    You can create a calculated column as below and put the new column onto the visual (its total value is the number of strings containing Win 10).

     

    IsexistWin10 = 
    VAR _exist =
        IFERROR ( SEARCH ( "Win 10", 'Document'[CoS_ShortSummary] ), 0 )
    RETURN
        IF ( _exist > 0, 1, 0 )

     

    Best Regards

    Rena