Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
misiek5510
Helper III
Helper III

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

1 ACCEPTED SOLUTION

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.

View solution in original post

16 REPLIES 16
misiek5510
Helper III
Helper III

Hi guys,

 

 

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

misiek5510_0-1634842193540.png

 

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.

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

 

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.

Thank you very much just what I needed. 

parry2k
Super User
Super 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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super 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.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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). 

AlexisOlson
Super User
Super User

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

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.

 

parry2k
Super User
Super 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?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes adding it as a measure, and it does not work.

misiek5510
Helper III
Helper 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?

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

 

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

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. 

misiek5510_0-1634749947142.png thats the icon. 

 

AlexisOlson
Super User
Super 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?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.