Forum Discussion
If contains function with a filter
Dear community,
I need your help.
I would like to filter my measure with 2 criteria
First on the service which must always be "Contrat Assistance G" and on the category which must start with "APPRO" I know how to do it with filters on the element but I would like to make a measurement of it.
Test =Calculate(distinctcount('dossiers') ....
Here are the values for the columns
Thank you
Hi Milozebre,
Assuming that your columns always start with the values you said then use this expression:
Count dossier = CALCULATE ( DISTINCTCOUNT ( 'Table'[Dossier] ); LEFT ( 'Table'[Service]; 20 ) = "Contrat Assistance G"; LEFT ( 'Table'[Categorie]; 5 ) = "APPRO" )If the columns don't start by that text but need to have that text within the column try this one:
Count dossier = CALCULATE ( DISTINCTCOUNT ( 'Table'[Dossier] ); FIND ( "Contrat Assistance G"; 'Table'[Service]; 1; 0 ) > 0; FIND ( "APPRO"; 'Table'[Categorie]; 1; 0 ) > 0 )Regards,
MFelix
2 Replies
- MFelixSuper User
Hi Milozebre,
Assuming that your columns always start with the values you said then use this expression:
Count dossier = CALCULATE ( DISTINCTCOUNT ( 'Table'[Dossier] ); LEFT ( 'Table'[Service]; 20 ) = "Contrat Assistance G"; LEFT ( 'Table'[Categorie]; 5 ) = "APPRO" )If the columns don't start by that text but need to have that text within the column try this one:
Count dossier = CALCULATE ( DISTINCTCOUNT ( 'Table'[Dossier] ); FIND ( "Contrat Assistance G"; 'Table'[Service]; 1; 0 ) > 0; FIND ( "APPRO"; 'Table'[Categorie]; 1; 0 ) > 0 )Regards,
MFelix
- MilozebreHelper V
Good morning MFelix,
Its working.
Thnak you very much