Forum Discussion
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
- AlexisOlsonSuper User
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?
- misiek5510Helper III
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?
- AlexisOlsonSuper User
Can you verify that [Col1] is a calculated column rather than a measure?
The icon will look different (a table vs a calculator).
- misiek5510Helper 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.
- parry2kSuper User
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?
- misiek5510Helper III
Yes adding it as a measure, and it does not work.
- AlexisOlsonSuper User
Can you share an example file or any other way that we can reproduce what you're seeing?
- misiek5510Helper 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.
- parry2kSuper User
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.
- misiek5510Helper 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).
- parry2kSuper User
misiek5510 Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 - misiek5510Helper III
Hi guys,
I've edited the original message with the actual data. Below is the error I'm getting.
- AlexisOlsonSuper 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.
- misiek5510Helper III
Yes it is a measure. Is there no way to perform a count on it?