Trying to build query with calculated field using multiple table fields.

bravura

Board Regular
Joined
Jan 27, 2010
Messages
54
TOTAL_REVENUE: ([Total_MT]*[MTON_RATE])+([NbrOfD20Bkd]*[D20_RATE])+([NbrOfD40Bkd]*[D40_RATE])

or TOTAL_REVENUE: (([Total_MT]*[MTON_RATE])+([NbrOfD20Bkd]*[D20_RATE])+([NbrOfD40Bkd]*[D40_RATE]))


Above returns null value. if i select any one of the three calculations, it runs ok even if i add specific numbers, but any two or all three together don't work.

all field types are the same (Three are integer, three are currency)


ex.

Calculation and Return

TOTAL_REVENUE: ([Total_MT]*[MTON_RATE]) = $100
TOTAL_REVENUE: ([Total_MT]*[MTON_RATE]) + 1000 = $1100

TOTAL_REVENUE: ([NbrOfD20Bkd]*[D20_RATE]) = $100
TOTAL_REVENUE: ([NbrOfD40Bkd]*[D40_RATE]) = $100

and so on, you get it


but


TOTAL_REVENUE: ([Total_MT]*[MTON_RATE])+([NbrOfD20Bkd]*[D20_RATE])+([NbrOfD40Bkd]*[D40_RATE]) = null
 
sold by weight (MTON) or by unit (D20 and/or D40). someone on another board pointed out that if any one of three has null value, return will be null.
 
Upvote 0
fixed. i created separate query. iif(isnull(... then zero. then used that for rev calc.
I prob didn't need separate query but may need this for future calcs in the future.
 
Upvote 0
Solution

Forum statistics

Threads
1,226,876
Messages
6,193,457
Members
453,801
Latest member
777nycole

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top