The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
I dont know how to solve this, maybe someone will know, maybe you?
In my understanging of power Bi I need e measure that makes calculation on column dynamicly calculated in thid measure. Is it possible or is there different solution to this? Look at the data:
Order 1 | Customer A | Product 1 |
Order 1 | Customer A | Product 2 |
Order 2 | Customer A | Product 1 |
Order 3 | Customer B | Product 2 |
Order 4 | Customer C | Product 1 |
Now, I need to display the number of customers that had a specific number of orders, and filter visual according to the product type.
So at the beginig:
Customers with 1 order: 2 (B, C)
Customers with 2 orders: 1 (A)
Thats easy, I can do calculated column for that. But thats static. Now I want to filter this data according to the product:
For product 1
Clients with 1 order: 1 (C)
Clients with 2 orders: 1 (A)
And so on...
I have about 1500 customers, 100 products and they make about 10 000 orders in a year.
Any ideas?
I tried to calculate this first column within a measure, but it seems any functions like count need to have name of an existing calcutated column and it didnt work. I feel this case is beyond my pBI skill right now 😕 Help pls 😄
hI @KasZaz ,
A calculated column is, of course, static but what are you really trying to achieve? If you want the count of orders by product by customer, you can simply create a calc column for that.
=
CALCULATE (
COUNTROWS ( 'table' ),
//countrows - assuming that each row in the table is equivalent to an order
FILTER (
'table',
'table'[customer]
= EARLIER ( 'table'[customer] ) & 'table'[product]
= EARLIER ( 'table'[product] )
)
)
Thank for replying a lot,
so yeah, EARLIER function is half of my solution that I didnt know, I have to admit. But how do I count them, not counting one Customer many times?
So my table now is:
By customer by product count | ||||
Order 1 | Customer A | Product 1 | 2 | |
Order 1 | Customer A | Product 2 | 1 | |
Order 2 | Customer A | Product 1 | 2 | |
Order 3 | Customer B | Product 2 | 1 | |
Order 4 | Customer C | Product 1 | 1 |
So for product 1 number of customers with 1 order is: 1
For product 1 number of customers with 1 orders is: 1
for product 2.... and so on
So basicly how to count ones and twos in this column, counting every customer only once. Filtering or slicing by product I think I can handle.
User | Count |
---|---|
69 | |
64 | |
62 | |
55 | |
28 |
User | Count |
---|---|
184 | |
82 | |
65 | |
48 | |
38 |