Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
dbrandone
Helper III
Helper III

New to Power BI and Need some guidance

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:

CustomerItem Purchased
John DoeHat
Jane DoeHat
Mike SmithHat
Carol DavisSocks
Steve WilliamsScarf
Shawn SpencerShoes
Stephanie DavisHat
Mike SmithHat
Steve WilliamsShoes
Shawn SpencerHat
Stephanie DavisScarf
Jane DoeHat
Mike SmithSocks
Carol DavisScarf
Steve WilliamsScarf
Shawn SpencerShoes
Stephanie DavisScarf
Mike SmithSocks
Steve WilliamsHat
Shawn SpencerHat
Stephanie DavisHat
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

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

vyangliumsft_0-1624248085447.png

 

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.

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

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

vyangliumsft_0-1624248085447.png

 

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.

parry2k
Super User
Super User

@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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.