Forum Discussion

jmfillman's avatar
jmfillman
Helper I
2 years ago
Solved

IF Against Calculate CountRows

This function outputs a correct count:   CALCULATE(COUNTROWS (     FILTER ( 'Stakeholders', CONTAINSSTRING ( 'Stakeholders'[Function], "SME") || CONTAINSSTRING('Stakeholders'[Role], "SME" )))+0) ...
  • Daniel29195's avatar
    2 years ago

    jmfillman 

     

     I would suggest to do the following : 

     

     

    create 2 columns in the table : 
    firs_col =  if( CONTAINSSTRING ( 'Stakeholders'[Function], "SME")  , "YES")

     

    second_col = CONTAINSSTRING('Stakeholders'[Role], "SME" ) , "YES")

     

    then change your measure as follow : 

    measure  =

    var sfilter ( 'Stakeholders' , 'Stakeholders'[firs_col] = "YES " || 'Stakeholders'[second_col] = "YES " ) 

    var res =  countrows ( s ) 

     

    RETURN

    switch(

    true() , 

    res >=5 , "PASS" , "FAIL" ) 

     

     

    let me know if this helps. 

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up ๐Ÿ‘ and mark it as the solution โœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! ๐Ÿค