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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rfwjr64
Frequent Visitor

Measure to count items in a table

Hello, I am struggling to write a measure that does the following:

In one data table, I have a total inventory column, a sales channel column that identifies where the inventory is located and I have a column that identifies the Part Number inventory that is currently available  .  I have a reference table that also contains Part Number, but it also contains more information about the part number, like Part Group, Part Class, etc.  The two tables have a relationship using Part Number.  What I am trying to do is count the number of part groups by sales channel.  I am not very experienced using DAX or measures, so any guidance and information about how I might achieve this goal is much appreciate.

 

Additionally, the data table that contains the sales information is labeled INVENTORY and the table that contains all of the additional references to the Part Number is labeled Ref_Material.  There is a many to one relationship going from the INVENTORY  table to the Ref_Material table.  I am not very experienced using DAX or measures, so any guidance and information about how I might achieve this goal is much appreciated.

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

If you have a relationship between the tables you don't necessarily need DAX. You can select count distinct here and you will get the result you want:

ValtteriN_0-1643299764745.png



My test data:

ValtteriN_1-1643299808095.png

 

ValtteriN_2-1643299826572.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ValtteriN
Super User
Super User

Hi,

If you have a relationship between the tables you don't necessarily need DAX. You can select count distinct here and you will get the result you want:

ValtteriN_0-1643299764745.png



My test data:

ValtteriN_1-1643299808095.png

 

ValtteriN_2-1643299826572.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.