Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
our company have 3 products and each product avaialble in 3 packs (100ML, 200ML, 300ML)
what I m trying do is to count the customers those purchased each 3 packs regardless of product.
e.g.
customer 1 purchased each 3 pack of same product so PBI should count 1
customer 2 purchased each 3 product but only 1 pack so count = 0
hope my requirement is clear.
below are 3 tables
and file Link
Solved! Go to Solution.
Try
# customers bought all packs =
VAR TotalPacks = COUNTROWS( ALL( 'Product'[Pack] ) )
VAR Result =
COUNTROWS(
FILTER(
GROUPBY(
SUMMARIZE(
'Sales',
'Customer'[Customer Code],
'Product'[Pack]
),
'Customer'[Customer Code],
"@num packs", SUMX( CURRENTGROUP( ), 1 )
),
[@num packs] = TotalPacks
)
)
RETURN
Result
pls try this
Measure =
COUNTROWS (
FILTER (
SUMMARIZE (
'Sales',
Sales[Customer Code],
"Count",
COUNTROWS (
DISTINCT (
SUMMARIZE (
FILTER ( 'Sales', [Value] > 0 ),
Sales[Customer Code],
'Product'[Product Name]
)
)
)
),
[Count] = 3
)
)
pls try this
Measure =
COUNTROWS (
FILTER (
SUMMARIZE (
'Sales',
Sales[Customer Code],
"Count",
COUNTROWS (
DISTINCT (
SUMMARIZE (
FILTER ( 'Sales', [Value] > 0 ),
Sales[Customer Code],
'Product'[Product Name]
)
)
)
),
[Count] = 3
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LeanAndPractise(Everyday) ) |
Thanks for the reply,
actually there was mistake in my file as all customer bought all packs. but in this linked file i corrected it.
if you see below screen shot except customer 2 all customers purchased all packs. hence customer count should be 5,
also i will be gradeful if you explain how this dax query works.
thanks in advance.
First of all, clarify which is the case you expect, Customer 1 or 2?
Case 1 is a bit more complex than 2.
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LeanAndPractise(Everyday) ) |
Try
# customers bought all packs =
VAR TotalPacks = COUNTROWS( ALL( 'Product'[Pack] ) )
VAR Result =
COUNTROWS(
FILTER(
GROUPBY(
SUMMARIZE(
'Sales',
'Customer'[Customer Code],
'Product'[Pack]
),
'Customer'[Customer Code],
"@num packs", SUMX( CURRENTGROUP( ), 1 )
),
[@num packs] = TotalPacks
)
)
RETURN
Result
User | Count |
---|---|
103 | |
90 | |
78 | |
72 | |
68 |
User | Count |
---|---|
108 | |
96 | |
95 | |
74 | |
71 |