Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hello,
I have the table bellow with date, order number, value and 5 columns for the 5 promotions that i can use an each order.
What is the best way to get total orders by promotions and the quantity orders by promotion.
Regard that i can have the same promotion in difierent column buy never same promotion on the same order (Row)
Thaks for all
Regards
Luis
I would unpivot your promotion columns.
Hu Greg,
I tried that, but with that i got duplicates orders values.
Sorry, im really bad with pivot and unpivot ;(
thanks
Means that for each order we can have up to 5 promotions attached.
Ex:
Order 10, can have, 10% discount for the 1st purchase, 10% birthday month, Free shipping and 15% discount with salesman code
Order 20, can have free Shipping and 10% discont for the fisrt purchase
Order 30, can have 10% birthday discount
Order 40, can have 15% discount with salesman code
....
regards
Luis
Here's a solution attached that uses the Many-To-Many technique. Please analyze this thoroughly so that you understand it. I've put a note in the report that explains why it's working the way it does. If you want to know more about Many-To-Many, then please go to www.sqlbi.com and search for articles on it by typing in the Search Box "many to many."
Best
D
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |