# Database Discussions > MDX and Analysis Services >  SUM() on SET not working?

## Fredrik

Have worked on this MDX Query for a while but is stuck! Can not figure out why SUM() on GENERATE will not work, error is:
"SUM function expects a tulpe set expression for argument 1, a string or numeric expression was used"

WITH
MEMBER [Measures].[ParameterCaption] AS [Invoice].[Faktura].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[ParameterValue] AS [Invoice].[Faktura].CURRENTMEMBER.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS [Invoice].[Faktura].CURRENTMEMBER.LEVEL.ORDINAL
MEMBER [Measures].[Fakturabelopp1] AS SUM(
	IIF(
			[Invoice].[Faktura].CURRENTMEMBER.LEVEL.ORDINAL = 2, ([Measures].[HeadAmount], [Invoice].[Faktura].FIRSTCHILD),
				IIF(
					[Invoice].[Faktura].CURRENTMEMBER.LEVEL.ORDINAL = 1,
					GENERATE(
							DESCENDANTS([Invoice].[Faktura].CURRENTMEMBER, [Invoice].[Faktura].[Fakturanummer]),
							(DESCENDANTS([Invoice].[Faktura].CURRENTMEMBER, [Invoice].[Faktura].[Fakturarad]).ITEM(0), [Measures].[HeadAmount])
							)
					, NULL)
		))
SELECT {
		[Measures].[ParameterCaption],
		[Measures].[ParameterValue],
		[Measures].[ParameterLevel],
		[Measures].[Fakturabelopp1]
		} ON COLUMNS,
		(
		[Bolag].[Bolag].[Bolag].&[G10]*[Invoice].[Faktura].[Fakturaserie]
		)
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM [Visma Control]
WHERE ([Tid].[Tid].[År].&[4])

Result with sum:
G10 - AB	G10KR	G10KR	[Invoice].[Faktura].[Fakturaserie].&[G10KR]	1	#Error
G10 - AB	G10KRI	G10KRI	[Invoice].[Faktura].[Fakturaserie].&[G10KRI]	1	#Error

Result without sum:
G10 - AB	G10KR	G10KR	[Invoice].[Faktura].[Fakturaserie].&[G10KR]	1	92775,8669501526,73734,423515,831256,119056
G10 - AB	G10KRI	G10KRI	[Invoice].[Faktura].[Fakturaserie].&[G10KRI]	1	12338538,4320612,54200038000420002-199511937,51
G10 - AB	G12KR	G12KR	[Invoice].[Faktura].[Fakturaserie].&[G12KR]	1	(null)
G10 - AB	G12KRI	G12KRI	[Invoice].[Faktura].[Fakturaserie].&[G12KRI]	1	(null)

----------

