cancel
Showing results for
Did you mean:
Helper III

## DAX Contains Text Statement

I am trying to calculate the total cost of Amount Recovered using [Net] field of the records within the  Main Claim Data field that has OT in the ClassofBusinessCode and the PolicyCode contains REC - the Policy Code needs to contain REC as opposed to is REC - the code below is not working - can anyone help

Amount Recovered Uninsured Loss £ = SUMX ( FILTER ( 'Main Claim Data', [ClassOfBusinessCode] = "OT" ),
&& CONTAINSSTRINGEXACT ( [PolicyCode], "REC" )
[Net] )
1 ACCEPTED SOLUTION
Continued Contributor

@spandy34

Please create a calculated colum (dont give space between table name and col name)
calculatedcolumn = SEARCH("REC",'Table'[PolicyCode],,-1)
Then create measure
= CALCULATE(SUM('Table'[Net]),'Main Claim Data', [ClassOfBusinessCode] = "OT" && 'Main Claim Data',[calculatedcolumn] > 0)

If this comment helps you, please LIKE this comment/Kudos

5 REPLIES 5
Continued Contributor

@spandy34
= VAR _rec = SEARCH("REC",'Table'[PolicyCode],,-1)
RETURN
CALCULATE(SUM('Table'[Net]),'Main Claim Data', [ClassOfBusinessCode] = "OT" && _rec > 0)

If not solved, please keep posted (paste sample data)
If this comment helps you, please LIKE this comment/Kudos

Helper III

This is the message I get

Continued Contributor

@spandy34

Please paste some sample data here or share pbix

Continued Contributor

@spandy34

Please create a calculated colum (dont give space between table name and col name)
calculatedcolumn = SEARCH("REC",'Table'[PolicyCode],,-1)
Then create measure
= CALCULATE(SUM('Table'[Net]),'Main Claim Data', [ClassOfBusinessCode] = "OT" && 'Main Claim Data',[calculatedcolumn] > 0)

If this comment helps you, please LIKE this comment/Kudos

Helper III

Announcements