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
Anonymous
Not applicable

Help with a sum formula

Hi, am very new to DAX, but trying to learn fast.

 

I have a  situtation where I'm trying to count the number of one item that exists in another column...

 

basicall my columns look like this

 

Container    Item

Box1           pear

Box1           apple

Box1           peach

Box2           apple

Box2           banana

 

 

I'd like to show how many items are in each box in the following format,

 

Box1    3

Box2    2

 

seems easy, but I'm struggling to get the formula for some reason.

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

You do not need any formula as the PowerBI engine automatically counts the no. of products in the Second Column. Drag the column 1 first and then column 2 values to the table visual and right click the Column 2 and select Count.

 

count.PNG

You can also right click on any column in your table and create measure using the below formula:

 

CountofProducts:=COUNTA(TableName[ColumnName])

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

2 REPLIES 2
BhaveshPatel
Community Champion
Community Champion

You do not need any formula as the PowerBI engine automatically counts the no. of products in the Second Column. Drag the column 1 first and then column 2 values to the table visual and right click the Column 2 and select Count.

 

count.PNG

You can also right click on any column in your table and create measure using the below formula:

 

CountofProducts:=COUNTA(TableName[ColumnName])

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
Anonymous
Not applicable

thanks, that pointed me in the right direction.  With my data I ended up using a counta as you suggested. Initially, I had my fields reversed I believe so was getting inaccurate info.

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.