- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
COUNT in a measure
Hi,
Here is a sample table like the one I am working with
Order Number - Type
1 A
1 A
2 B
3 A
Some order numbers repeat, but I would like to only count each order number once, AND count only instances with Type "A". The result I am looking for using the example table above is
Order Number - Count
1 1
2 0
3 1
I cannot add a column, so I have to use measures.
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there!
Try this:
CALCULATE(
DISTINCTCOUNT( OrderNumber ),
Type = "A"
)
Let me know if that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am getting the error message below, as I cannot view it in any visual.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you share how you wrote the DAX code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure, it is:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is TranYN a measure?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Yes it is. Will this not work becaue of that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I made that measure because there were many different values that count as a "Yes" (as well as many that count as a "no"), and I am not sure how to incorporate them all to be counted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should not use a measure there, you should use the column in your table. If you have a column where you are taking the "Yes" value, use that.
Not sure exactly what you mean with "many different values that count as a "Yes" "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I figured it out, thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there!
Try this:
CALCULATE(
DISTINCTCOUNT( OrderNumber ),
Type = "A"
)
Let me know if that helps!
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
10-14-2024 02:53 AM | |||
04-23-2024 07:31 AM | |||
06-24-2024 08:30 PM | |||
07-25-2024 07:03 AM | |||
07-21-2024 09:43 PM |
User | Count |
---|---|
13 | |
12 | |
10 | |
7 | |
7 |
User | Count |
---|---|
18 | |
14 | |
11 | |
11 | |
10 |