Forum Discussion

alhashmi's avatar
alhashmi
New Member
6 years ago
Solved

Count Error

Hello,

 

I need to make a graph showing how many times each person has their name in column "Done by" and "Checked by". The issue is that the graph "Checked By" is correct but the graph for "Done by" is not - it's appearing the values of the column "Checked by" ("Done by" does not even have black values).

 

Could you kindly advise on where the error might be coming from and how to correct? I've already tried to start a new one from scratch and I ended up with the same problem.

 

https://imgur.com/FuPlQp4 (Graphs described above.)

 

Thank you in advance.

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi alhashmi ,

     

    Create one active relationship and on inactive relationship.

    Use USERELATIONSHIP() function to create a measure for the inactive column.

    Measure = CALCULATE(COUNT('Table'[Checked by]),USERELATIONSHIP('Table'[Checked by],Who[person]))

    Result would be shown as below.

     

    Best Regards,

    Jay

4 Replies

  • az38's avatar
    az38
    Community Champion

    alhashmi 

    I don't see where is your [People] field?

    does it connected via relationships or stored in the same table?

    • alhashmi's avatar
      alhashmi
      New Member

      Thank you for the quick response.

       

      It's connected via relationships, it has the values "Person A" "Person B" "Person C" and "Person D". At first I tried to use "Done by"/"Checked by" as axis, but due to the error I tried a different way to test out.

      • mahoneypat's avatar
        mahoneypat
        Microsoft Employee

        Since your relationship from the Who table can only be active with one of those fields at a time, you will need to use 1 of 2 approaches to count the other.  Assuming the relationship is active with Done By, here are two solutions for Checked By

         

        1. Make an inactive relationship between the People column and the Checked By column.  Use a measure like this

         

        Checked By Count = CALCULATE(COUNTROWS(Data), USERELATIONSHIP(Who[People], Data[Checked by]))

         

        2. Use a measure like this

        Checked By Count = CALCULATE(COUNTROWS(Data), TREATAS(VALUES(Who[People]), Data[Checked by]), ALL(Data[Done by]))

         

        If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

        Regards,

        Pat

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi alhashmi ,

     

    Create one active relationship and on inactive relationship.

    Use USERELATIONSHIP() function to create a measure for the inactive column.

    Measure = CALCULATE(COUNT('Table'[Checked by]),USERELATIONSHIP('Table'[Checked by],Who[person]))

    Result would be shown as below.

     

    Best Regards,

    Jay