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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
John_V12
Frequent Visitor

Divide two columns

Hi all,

I could not find the right formula for the below, can someone please assist:

 

I have two columns in one dataset, the one column is sales and the other is product quantity.

The sales column is not fully populated, but the quantity is.

When I try and divide sales by quantity I get the correct information in a matrix, but the total is incorrect.

 

How do I divide the sales, looking at the quantity ONLY when there is a sales value?

 

Thanks,

1 ACCEPTED SOLUTION
John_V12
Frequent Visitor

Hi all,
I solved the incorrect totals by creating a calculated column and not a measure.
Thanks!

View solution in original post

3 REPLIES 3
John_V12
Frequent Visitor

Hi all,
I solved the incorrect totals by creating a calculated column and not a measure.
Thanks!

V-lianl-msft
Community Support
Community Support

Hi @John_V12 ,

 

Try to create a measure like below:

Measure = DIVIDE(SUM('Table'[Sales]),SUM('Table'[Quantity]))

Vlianlmsft_0-1646804228465.png

If the problem persists, please share some sample data and the results you expect.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

littlemojopuppy
Community Champion
Community Champion

Hi @John_V12 

Try this...

DIVIDE(
	[SalesValue],
	[Quantity],
	BLANK()
)

DIVIDE() function will substitute BLANK() for any row where it cannot perform division (Quantity = 0 or is missing a value).

 

Hope this helps!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.