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.
Hi,
what function shall i use for a measure that dcounts names column "Name" which have only one/single occurance in column "Product".
what I have:
I want my measure to show:
Dcount of names that have only apples (BBB and DDD) = 2.
I can solve this with 2 steps but this way seems a bit coplicated.
1. adding an extra column "C" that shows how many distinct products each Name has;
2. and then creating a measure e.g. calculate(distinctcount(NAME), C = 1, Product = "apple". C = 1 means that eg DDD has only 1 product.
thank you in advance
Solved! Go to Solution.
Hi, @Kudy
In fact, your original solution is sufficiently general and straightforward. The code I provide below is just to give you a different idea.
Measure1 =
VAR tab1 =
SUMMARIZE (
'Table',
'Table'[Name],
"first_product", MIN ( 'Table'[Product] ),
"last_product", MAX ( 'Table'[Product] )
)
RETURN
COUNTROWS (
FILTER ( tab1, [first_product] = "apple" && [last_product] = "apple" )
)
Best Regards,
Community Support Team _ Eason
HI @Kudy
Try this:
Measure = calculate(distinctcount(table[name]),filter(all(table),table[product]="apple"))
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Hi Vahid,
and thank you for your answer!
I tried your solution but unfortunately did not get the result I needed. It gave me = 3 instead of 2
Hi, @Kudy
In fact, your original solution is sufficiently general and straightforward. The code I provide below is just to give you a different idea.
Measure1 =
VAR tab1 =
SUMMARIZE (
'Table',
'Table'[Name],
"first_product", MIN ( 'Table'[Product] ),
"last_product", MAX ( 'Table'[Product] )
)
RETURN
COUNTROWS (
FILTER ( tab1, [first_product] = "apple" && [last_product] = "apple" )
)
Best Regards,
Community Support Team _ Eason
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
43 | |
20 | |
18 | |
16 | |
15 |
User | Count |
---|---|
49 | |
26 | |
22 | |
17 | |
16 |