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

DAX Formula

Hey y'all, greetings!

I am facing issues developing this DAX formula. My case is that I created one measure like this: Measure A = (SUM(Field A) / SUM(Field B)). It is working pretty well but now, I have to create another measure that returns the (SUM(Measure A) / DISTINCTCOUNT(Field C)). Since I can't sum it, my test gone wrong with this DAX: Measure B = (Measure A / DISTINCTCOUNT(Field C)), I think this example clarifies my idea:

                 A           B           Measure A                 
Sale 1: 27,00     20,00                     1,35
Sale 2: 30,80     70,00                     0,44

Right now, I have to summarize the results of Measure A and divide by Total of Sales.
SHOULD BE: (1,35 + 0,44) / 2 = 0,89
IS DOING:     ((27,00 + 30,80) / (20,00 + 70,00)) / 2 = 0,32

What should be the correct form of my DAX?

Gratefull for your attention!

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous

 

i think you should summarize you table

 

SummarizeTable = SUMMARIZE(Table2;Table2[C];"A";DIVIDE(SUM(Table2[A]);SUM(Table2[B]))) 

... and make you calculation on the summarized table.

 

Measure = DIVIDE(SUM(SummarizeTable[A]);COUNT(SummarizeTable[C])) 

Summarize.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

2 REPLIES 2
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous

 

i think you should summarize you table

 

SummarizeTable = SUMMARIZE(Table2;Table2[C];"A";DIVIDE(SUM(Table2[A]);SUM(Table2[B]))) 

... and make you calculation on the summarized table.

 

Measure = DIVIDE(SUM(SummarizeTable[A]);COUNT(SummarizeTable[C])) 

Summarize.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


AlB
Community Champion
Community Champion

Hi @Anonymous

I'm having a bit of a hard time trying to understand what you need

What is Field C?

What you show (below), is it a table? Measure A is a column of that table??

 

                 A           B           Measure A                 
Sale 1: 27,00     20,00                     1,35
Sale 2: 30,80     70,00                     0,44

 

I'm really going out on a limb here but maybe what you need is:

 

SUMX(Table; [Column A] / [Column B] )  / COUNTROWS(Table)

 

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.