Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I need help to wright DAX formula to make a table witр top 2 selling products for every seller. The input data tabler has the following form:
Products | Seller | Sales |
Product1 | Seller1 | 5000 |
Product2 | Seller1 | 5539 |
Product3 | Seller1 | 5892 |
Product4 | Seller1 | 5872 |
Product5 | Seller2 | 9285 |
Product6 | Seller2 | 4928 |
Product7 | Seller2 | 5928 |
Product8 | Seller2 | 9287 |
ProductN… | SellerN… | 9284 |
Solved! Go to Solution.
Hi @Raaassotto
Please try
Top 2 Products =
GENERATE (
VALUES ( 'Table'[Seller] ),
TOPN (
2,
SUMMARIZE (
CALCULATETABLE ( 'Table' ),
'Table'[Product],
"Total Sales", SUM ( 'Table'[Sales] )
),
[Total Sales]
)
)
Hi @Raaassotto
Please try
Top 2 Products =
GENERATE (
VALUES ( 'Table'[Seller] ),
TOPN (
2,
SUMMARIZE (
CALCULATETABLE ( 'Table' ),
'Table'[Product],
"Total Sales", SUM ( 'Table'[Sales] )
),
[Total Sales]
)
)
User | Count |
---|---|
47 | |
26 | |
22 | |
17 | |
15 |
User | Count |
---|---|
53 | |
34 | |
17 | |
17 | |
15 |