Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Everyone,
I need to calculate count/DistinctCount based on a condition.
For example in below table, when Type is "Agreement1", I should determine total count of "Customer" for "Agreement1".
When Type is Agreement2, I should determine distinct count of "Customer" for "Agreement2"
Partner | Customer | Type |
p1 | c1 | Agreement1 |
p1 | c2 | Agreement1 |
p2 | c1 | Agreement1 |
p2 | c3 | agreement2 |
p3 | c2 | agreement2 |
p4 | c3 | agreement2 |
p1 | c3 | agreement2 |
In the below case, I should get numbers like this
Agreement1 | agreement2 |
3 | 2 |
Can you please let me know how can we acheive this through single DAX measure.
NOTE: I even have date columns, so I should be able to slice it accordingly through dates
Thanks,
Raksha
Solved! Go to Solution.
Hi @raksharh ,
You can use the below measure:
Hi @raksharh ,
You can use the below measure:
Hi! If you just need those two measures let's see.
I think this should be enough.
Agreements1 =
CALCULATE (
COUNT(Table[Customer]),
Table[Type] = "Agreement1"
)
In the second case
Agreements2 =
CALCULATE (
DISTINCTCOUNT(Table[Customer]),
Table[Type] = "agreement2"
)
Hope this help,
Regards,
Happy to help!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
23 | |
21 | |
20 | |
13 | |
12 |
User | Count |
---|---|
43 | |
31 | |
24 | |
23 | |
22 |