cancel
Showing results for 
Search instead for 
Did you mean: 

Format of calculation field in query

former_member522789
Participant
0 Kudos

Hello

I hva emade the following query but I want the gross margin/doc total to be shown in a different format today it is 1 or 0 but it should be shown as a percentage like 10.3 or 20.4

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T0.[U_ZREF], T0.[U_ZREF2], T0.[Weight], - T0.[GrosProfit], - T0.[DocTotal], T0.[GrosProfit]/T0.[DocTotal] FROM ORIN T0 WHERE T0.DocDate = '[%0]'

UNION ALL

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T0.[U_ZREF], T0.[U_ZREF2], T0.[Weight], T0.[GrosProfit], T0.[DocTotal], T0.[GrosProfit]/T0.[DocTotal] FROM OINV T0 WHERE T0.DocDate = '[%0]'

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T0.[U_ZREF], T0.[U_ZREF2], T0.[Weight], - T0.[GrosProfit], - T0.[DocTotal], T0.[GrosProfit]/T0.[DocTotal] FROM ORDN T0 WHERE T0.DocDate = '[%0]'

UNION ALL

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T0.[U_ZREF], T0.[U_ZREF2], T0.[Weight], T0.[GrosProfit], T0.[DocTotal], T0.[GrosProfit]/T0.[DocTotal] FROM ODLN T0 WHERE T0.DocDate = '[%0]'

ORDER BY T0.[CardCode]

Thank you for your help

Accepted Solutions (1)

Accepted Solutions (1)

former_member186095
Active Contributor
0 Kudos

Hi,

Try this one:


SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.U_ZREF, T0.U_ZREF2, T0.Weight, - T0.GrosProfit, - T0.DocTotal, T0.GrosProfit/T0.DocTotal*100 FROM ORIN T0 WHERE T0.DocDate = '[%0]'
UNION ALL
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.U_ZREF, T0.U_ZREF2, T0.Weight, T0.GrosProfit, T0.DocTotal, T0.GrosProfit/T0.DocTotal*100 FROM OINV T0 WHERE T0.DocDate = '[%0]'
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.U_ZREF, T0.U_ZREF2, T0.Weight, - T0.GrosProfit, - T0.DocTotal, T0.GrosProfit/T0.DocTotal*100 FROM ORDN T0 WHERE T0.DocDate = '[%0]'
UNION ALL
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.U_ZREF, T0.U_ZREF2, T0.Weight, T0.GrosProfit, T0.DocTotal, T0.GrosProfit/T0.DocTotal*100 FROM ODLN T0 WHERE T0.DocDate = '[%0]'
ORDER BY T0.CardCode

let me know if you need more detail

Rgds,

former_member522789
Participant
0 Kudos

Thanks I have thought of more complicated solution when you provide me with an easy one....

If I want one decimal digit do you hav e atrick... With your idea it shows round figures but it helps anyhow....

Answers (0)