Forum Discussion

JoseLuisAGZZ's avatar
JoseLuisAGZZ
Helper I
5 years ago

Count and filter

Hello everybody

 

Im trying to count the number of employees (thats the first column) but i have no idea how to do it, in the table I have a measure that counts by a criterion, I use this formula so I can count the days that some person have been incapacitated, but also need the number of employees the count of the first coulmn but i have no clue on what to do
CALCULATE(
                    COUNT( Employee Number),
                                   CriteriaColumn = Criteria 1 || CriteriaColumn = Criteria 2)

any help would be appreciated
Thanks in advance


 

3 Replies

  • JoseLuisAGZZ ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
    Appreciate your Kudos.

    • JoseLuisAGZZ's avatar
      JoseLuisAGZZ
      Helper I

      We have a database where we collect daily information about all our employees and theres a column called criteria and in this column we have more than 10 criteria to choose from, but im doing a report for just one specific criteria

      So what im doing first its to count all the times this specific criteria appears for each of our employees with the next measure

      CALCULATE(
                          COUNT( Employee Number),
                                         CriteriaColumn = Criteria 1 || CriteriaColumn = Criteria 2)

       

      whit this we can see how many times in the month a person have this criteria, but now I need to display a card where I can see how many unique employees appear for this criteria
      Ive tried with 

      CALCULATE(DISTINCTCOUNT), CRITERIA COLUMN = 'CRITERIA')

      but its not working

      so if you have an idea on how to calculate that, i would appreciate it so much

       

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Community Support

    Hi @ JoseLuisAGZZ,

     

    According to your description, you want to calculate how many unique employees appear for this criteria.

     

    Try this measure

    Measure 1 =

    CALCULATE(

             DISTINCTCOUNT('Table'[EmployeeNumber]),

             FILTER('Table','Table'[CriteriaColumn]="CRITERIA")

    )

     

    Best Regards!

    Community Support Team _ chenwu zhu

     

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