# How to sum quantity with Price = 0\$ in MDX?

### Question

•  Invnetory Name Quantity Price Amount DELL 2 50\$ SONY VAIO 12 100\$ LENOVO 4 12\$ SAMSUNG 5 11\$ SAMSUNG1 12 0\$ DELL1 16 0\$

How to sum quantity with Price count = 0 in MDX?

When it show in excel sum(Quantity) always equal 2+12+4+5+12+16. But I want 12+16 with condittion Price = 0\$

tHANKS!

Tuesday, October 08, 2013 8:00 AM

• Try this code, should work

```with set  Inventory_Filtered as  filter([Inventory].[Inventory].members,[Measures].[Price Ampunt]=0)

member [Measures].[Sum Qty] as sum(Inventory_Filtered ,[Measures].[Quantity]

select [Measures].[Sum Qty] on 0

from [cube name]```

http://www.bifeeds.com

• Marked as answer by Tuesday, October 08, 2013 9:24 AM
• Unmarked as answer by Tuesday, October 08, 2013 9:24 AM
• Marked as answer by Tuesday, October 08, 2013 9:24 AM
Tuesday, October 08, 2013 8:54 AM

### All replies

• Try this code, should work

```with set  Inventory_Filtered as  filter([Inventory].[Inventory].members,[Measures].[Price Ampunt]=0)

member [Measures].[Sum Qty] as sum(Inventory_Filtered ,[Measures].[Quantity]

select [Measures].[Sum Qty] on 0

from [cube name]```

http://www.bifeeds.com

• Marked as answer by Tuesday, October 08, 2013 9:24 AM
• Unmarked as answer by Tuesday, October 08, 2013 9:24 AM
• Marked as answer by Tuesday, October 08, 2013 9:24 AM
Tuesday, October 08, 2013 8:54 AM
• Thanks  Yogish Bhat,

I try!

Tuesday, October 08, 2013 9:24 AM
• Friday, October 11, 2013 1:27 AM