Forum Discussion

John_V12's avatar
John_V12
Frequent Visitor
4 years ago
Solved

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,

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

3 Replies

  • littlemojopuppy's avatar
    littlemojopuppy
    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!

  • John_V12's avatar
    John_V12
    Frequent Visitor

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