Forum Discussion

Milozebre's avatar
Milozebre
Helper V
8 years ago
Solved

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 ...
  • MFelix's avatar
    8 years ago

    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