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
PeeWhy
Frequent Visitor

Count number of times a value appears in a column, then use that number in multiple calculations

Hello all.  I am trying to duplicate something I do in excel using formulas but I am failing miserably.  Hopefully, I explain it enough here that possibly someone can help me achieve my goal.  Also, I am asking (4) different calculation questions in a single post.  I am not sure it's allowed but it's all related.

 

Table1 is a static table getting refreshed/updated via a CSV file.

Table1
Project  Dollars
AAA$2.00
BBB$4.00
CCC$7.00
BBB$2.00
AAA$6.00
AAA$4.00

 

Table2 is a calculated table where I want to perform the calculations.

The Unique Projects column seems to be OK however I have no idea how to achieve the rest of the needed calculations.

Here is what I am using for a unique projects list.  (although I am not sure I built my initial Table2 correctly by starting it off with this first column)

 

Table2 = DISTINCT(Table1[Project])

 

SUMIF - I need to perform a SUMIF, summing up the Dollars from Table1 if the Project number matches in Table2.

Project Occurrence - I need to count the number of times a Project appears in Table1.

Sum/Occurrence - I need to divide the SUMIF result by the Project Occurrence result line by line down the table.

Table2
Unique Projects  Sumif  Project Occurrence  Sum / Occurrence
AAA $12.00    3  $4.00
BBB $6.00    2  $3.00
CCC $7.00    1  $7.00

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@PeeWhy So, create a relationship between your two tables on the Project. Then just create a SUM measure for summing Dollars in Table1. Create a COUNT measure for summing Project column in Table1. That should be all there is to it. Oh, and create another measure the multiplies those two measures.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@PeeWhy So, create a relationship between your two tables on the Project. Then just create a SUM measure for summing Dollars in Table1. Create a COUNT measure for summing Project column in Table1. That should be all there is to it. Oh, and create another measure the multiplies those two measures.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you so much.  I didn't even think about making a relationship between the two tables.  That small step along with 3 different measures gives me exactly what I need.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.