Forum Discussion

BJ_TS's avatar
BJ_TS
Regular Visitor
3 years ago
Solved

Problem counting number of rows when using Filter with AND-logic

Hi. I have a table "PersonCertificates" with two columns: Person   Certificate MrA   Cert1 MrA   Cert2 MrA   Cert3 MrB   Cert1 MrB   Cert2 MrC   Cert3 I have a slicer for Certificate and ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi BJ_TS ,

    I have created a simple sample, please refer to it to see if it helps you.

    CountNumber = 
    
    var _a = SELECTCOLUMNS('Table 2',"Certificate",[Certificate])
    
    return CALCULATE(DISTINCTCOUNT('Table'[Person]),FILTER(ALL('Table'),[Certificate] in _a))
    Name = 
    
     var _a = SUMMARIZE(ALL('Table'),[Person],"Flag",CALCULATE(COUNT('Table'[Certificate]),FILTER(ALL('Table'),[Certificate] in SELECTCOLUMNS('Table 2',"Certificate",[Certificate])&&[Person]=EARLIER('Table'[Person]))))
    
     var _b = COUNTROWS(ALLSELECTED('Table 2'[Certificate]))
    
     return MAXX(FILTER(_a,[Person]=SELECTEDVALUE('Table'[Person])&&[Flag]=_b),[Person])

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.