Forum Discussion

misiek5510's avatar
misiek5510
Helper III
4 years ago
Solved

Count Custom Dax Column

Hi,

 

I have measure that is an if statement and gives either "completed" or "not completed" output in a table and is called warehouse status. Now I have a table that display's everything correctly, but I'd like to create additional table that will be a summary table and will count how many "completed" and "not completed" there are. 

Example:

Check= CALCULATE ( COUNT ( Base[Warehouse Status] ), Base[Warehouse Status] = "Completed" ) For example this formula will not work as it won't find the bit in red and all formulas I find online work the same way!.

Help

  • You can use it within a count like this:

    COUNTROWS ( FILTER ( Base, [Warehouse Status] = "Completed" ) )

     

    I don't know if this is what you're actually trying to count though.

16 Replies

  • It's not clear to me what you mean by "this formula will not work". Can you show what you're currently getting and explain how it differs from what you expect to get?

  • Yes basically when I get as far as:

    Yes = CALCULATE ( COUNT ( Table1[Col1] ),
    It will find Table1 but will not find Col1 and it just highlights it
     (No measures are shown), but when the reamaining of the forula is typed :

    Table1[Col1] = "Yes" )   
    in the second part it finds the Table1 and Col1 fine.

     

    Does it makes sense?

    • AlexisOlson's avatar
      AlexisOlson
      Super User

      Can you verify that [Col1] is a calculated column rather than a measure?

       

      The icon will look different (a table vs a calculator).

      • misiek5510's avatar
        misiek5510
        Helper III

        Yes it was created in Data View > New Column, I think that's a calculated column. Its not a measure but measures are also not visible when trying to use the formula above. 

         thats the icon. 

         

  • misiek5510 maybe this is the issue with the IntelliSense, even if shows no column found, does the measure still works?

     

    Just to confirm, you are adding this as a measure? Correct?

  • Can you share an example file or any other way that we can reproduce what you're seeing?

    • misiek5510's avatar
      misiek5510
      Helper III

      Sorry Alexis it is in fact a measure not a calculated column! Sorry for confusion. 

      THe error i get is : Column "Yes" in table "Table1" can not be found or may not be used in this expression.

       

  • misiek5510 it is not very helpful when you say it doesn't work? You are getting errors? if yes, what is that error or you are getting the wrong result. I think it is the first one, so if you can provide more details on the error that will help. You are just showing the measure you are doing but not what and how you are using it and what error/issue you are getting.

     

     

    • misiek5510's avatar
      misiek5510
      Helper III

      I don't have access to it atm but might be able to get it later on but for sure tomorrow. (since not providing a lot of information as can not remember everything). 

  • Hi guys,

     

     

    I've edited the original message with the actual data. Below is the error I'm getting.

     

    • AlexisOlson's avatar
      AlexisOlson
      Super User

      From this screenshot, it's apparent that [Warehouse Status] is a measure, not a column. This is why you cannot use it inside COUNT or as part of a boolean filter argument.

      • misiek5510's avatar
        misiek5510
        Helper III

        Yes it is a measure. Is there no way to perform a count on it?