cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dbrandone
Helper I
Helper I

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.

View solution in original post

parry2k
Super User III
Super User III

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






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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors