Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi Power BI Users,
I have a table similar to below and trying to create a new measure by using DAX to get the distinct count of prodid&customers. In short, we are trying to calculate how many orders we have for each of the productID under each Customer.
Sampletable:
Order | ProductID | Customers |
XX1 | A | X |
XX6 | A | X |
XX7 | A | Y |
XX10 | A | Y |
XX2 | B | Y |
XX3 | B | X |
XX4 | B | X |
XX5 | B | Y |
XX8 | C | X |
XX9 | C | X |
Desired output on 4th column:
Order | Product ID | Customers | Distinct Count of ProdID x Customers |
XX1 | A | X | 2 |
XX6 | A | X | 2 |
XX7 | A | Y | 2 |
XX10 | A | Y | 2 |
XX2 | B | Y | 1 |
XX3 | B | X | 3 |
XX4 | B | X | 3 |
XX5 | B | Y | 3 |
XX8 | C | X | 2 |
XX9 | C | X | 2 |
I've tried out with below DAX but it shown error below,
Solved! Go to Solution.
@Vvelarde, this has been resolved by added in "KEEPFILTERS".
DC Prod by Customers =
CALCULATE (
DISTINCTCOUNT ( Table1[Order ] ),
KEEPFILTERS(ALLEXCEPT ( Table1, Table1[ProductID ], Table1[Customers] ))
)
THANK YOU!
Hi, try with this measure:
DC Prod by Customers = CALCULATE ( DISTINCTCOUNT ( Table1[Order ] ), ALLEXCEPT ( Table1, Table1[ProductID ], Table1[Customers] ) )
Regards
Victor
Thanks, @Vvelarde . This works pretty well if we are not filtering the data. However, lets say if there is a date column and we would love to filter by date and check what is the distinctcount, what can be
@Vvelarde wrote:
Hi, try with this measure:
DC Prod by Customers = CALCULATE ( DISTINCTCOUNT ( Table1[Order ] ), ALLEXCEPT ( Table1, Table1[ProductID ], Table1[Customers] ) )Regards
Victor
done in order to sync with the filters?
@Vvelarde, this has been resolved by added in "KEEPFILTERS".
DC Prod by Customers =
CALCULATE (
DISTINCTCOUNT ( Table1[Order ] ),
KEEPFILTERS(ALLEXCEPT ( Table1, Table1[ProductID ], Table1[Customers] ))
)
THANK YOU!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
48 | |
41 | |
34 |
User | Count |
---|---|
164 | |
111 | |
62 | |
53 | |
38 |