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.
Hello everyone,
I am new to Power BI and DAX but have a SQL background. I have a large database that I manage within SQL and have organized my views and tables to get the data I need. I have one table that hypothetically has a customer in one column and then what they purchased in another column in the same table. The customers name could be found throughout the same column many, many times and the item they purchased can be found many times throughout its column many times. I need to show a list or a chart of the customers with which items they purchased and the quantity of each item. Any help would be appreciated. I have been in Dax Studio and new measure within power bi for hours today and I haven't been able to wrap my head around it.
I know this is probably an easy measure but for some reason I cannot wrap my head around DAX. I am still waiting for that a-ha moment with it to where I can hit the ground running.
This is an example of what I mean by my example:
Customer | Item Purchased |
John Doe | Hat |
Jane Doe | Hat |
Mike Smith | Hat |
Carol Davis | Socks |
Steve Williams | Scarf |
Shawn Spencer | Shoes |
Stephanie Davis | Hat |
Mike Smith | Hat |
Steve Williams | Shoes |
Shawn Spencer | Hat |
Stephanie Davis | Scarf |
Jane Doe | Hat |
Mike Smith | Socks |
Carol Davis | Scarf |
Steve Williams | Scarf |
Shawn Spencer | Shoes |
Stephanie Davis | Scarf |
Mike Smith | Socks |
Steve Williams | Hat |
Shawn Spencer | Hat |
Stephanie Davis | Hat |
Solved! Go to Solution.
Hi @dbrandone ,
Here are the steps you can follow:
1. Create measure.
Count =
COUNTAX(FILTER(ALL('Table'),'Table'[Customer]=MAX('Table'[Customer])&&'Table'[Item Purchased]=MAX('Table'[Item Purchased])),'Table'[Item Purchased])
2. Take [Customer] as the slicer
3. Result:
Selecting a Customer displays the items and quantity he purchased
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @dbrandone ,
Here are the steps you can follow:
1. Create measure.
Count =
COUNTAX(FILTER(ALL('Table'),'Table'[Customer]=MAX('Table'[Customer])&&'Table'[Item Purchased]=MAX('Table'[Item Purchased])),'Table'[Item Purchased])
2. Take [Customer] as the slicer
3. Result:
Selecting a Customer displays the items and quantity he purchased
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@dbrandone as a best practice you want to create a star schema, in this case you should have 3 tables:
- customer dimension with all customers unique value
- product dimension with all products unique value
- sales fact table, contains customers, product, qty, amount etc etc
- sales table will have relationship with customer and product table, with one to many (one on dimension side)
add a measure, let's call it Sales Amount which will be SUM ( TableSales[Sales] )
To visualize, drop customer and/or product from dimension table and above measure and everything will work.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |