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 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!
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 |
---|---|
114 | |
100 | |
75 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |