TOPCOUNT query not working
when run query below 2 records back. if drop topcount, 508 records.
why not giving me top 5 508 records? missing?
regs
jon
with member measures.[emailcount] iif(isempty([measures].[tran count]), 0 ,[measures].[tran count]) member measures.[incomeperemail] [measures].[amount]/ iif(measures.[emailcount] = 0, 1 , measures.[emailcount] ) member measures.[income range] case when sum(existing [dim ifa details].[parent key].[adviser group].members, measures.[amount] ) <= 10000 '0-10000' when sum(existing [dim ifa details].[parent key].[adviser group].members, measures.[amount] ) <= 50000 '10001-50000' when sum(existing [dim ifa details].[parent key].[adviser group].members, measures.[amount] ) <= 100000 '50001-100000' when sum(existing [dim ifa details].[parent key].[adviser group].members, measures.[amount] ) <= 200000 '100001-200000' else '> 200000' end select { [measures].[amount] , measures.[emailcount], measures.[income range], measures.[incomeperemail] } on columns, topcount( nonempty([dim ifa details].[parent key].[adviser group].members, measures.amount) , 5 , measures.[incomeperemail] ) having measures.[income range] = '10001-50000' on rows [income , emails cube] [dim date].[fiscal year].&[fy 13/14]
i think having clause working after topcount. try using filter() inside topcount function.
topcount(filter(
nonempty([dim ifa details].[parent key].[adviser group].members, measures.amount)
,measures.[income range] = '10001-50000')
, 5
, measures.[incomeperemail]
)
on rows
hope helps,
topcount( nonempty([dim ifa details].[parent key].[adviser group].members, measures.amount) , 5 , measures.[incomeperemail] ) having measures.[income range] = '10001-50000' on rows
topcount( nonempty([dim ifa details].[parent key].[adviser group].members, measures.amount) , 5 , measures.[incomeperemail] ) having measures.[income range] = '10001-50000' on rows
richard
SQL Server > SQL Server Analysis Services
Comments
Post a Comment