
Re: To find the units of stock when we know the quantity and units sold
Gysbert Wassenaar Feb 23, 2016 11:48 AM (in response to Anuraj kokkeragadda)Try adding a field with the value 1 for each record: 1 As Sold. When you sum that field you'll have the number of sold cars.

Re: To find the units of stock when we know the quantity and units sold
Anuraj kokkeragadda Feb 24, 2016 12:27 AM (in response to Gysbert Wassenaar )Yes Gysbert I am getting the number of Sold Cars but how can i get the number of cars which were in stock.If i Write the expression Sum(Quantity) which is adding 140+139+138 of that same car.But i need to show it as if i have 140 as my intitial quantity and 3 cars are sold .To have the units in stock it should do as 1403 which will be the units of stock.
Actually in the fact table it is like
Model_ID Customer_ID Quantity Units Sold
M001 2001 140 1
M001 2002 139 1
M001 2003 138 1.
Can you suggest an expression through which i can get the initial quantitySum(Units Sold)

Re: To find the units of stock when we know the quantity and units sold
balraj ahlawat Feb 24, 2016 2:59 AM (in response to Anuraj kokkeragadda)try like this?
In Stock Expression= aggr(max(Quantity), Model_ID)  aggr(sum(UnitSold), Model_ID)

Re: To find the units of stock when we know the quantity and units sold
Anuraj kokkeragadda Feb 24, 2016 4:48 AM (in response to balraj ahlawat)Thank you Balraj It was giving the units in stock result.But it was giving when i selected an Model_ID.Can you tell the expression to give the overall stock in the company which includes all model_ID'S

Re: To find the units of stock when we know the quantity and units sold
balraj ahlawat Feb 24, 2016 5:46 AM (in response to Anuraj kokkeragadda)Take Model_ID as Dim in Pivot/Straight or Chart, and above mentioned expression as Stock expression


Re: To find the units of stock when we know the quantity and units sold
balraj ahlawat Feb 24, 2016 6:57 AM (in response to Anuraj kokkeragadda)see the attachment, its working for me without any selection....

Tes.qvw 153.5 K


Re: To find the units of stock when we know the quantity and units sold
balraj ahlawat Feb 24, 2016 7:01 AM (in response to Anuraj kokkeragadda)You can do like this as well?
Test:
load * Inline
[ModelID, Quantity, Sold
1001, 140,1
1001,139,1
1001,138,1
];
Test1:
load
ModelID,
max(Quantity)sum(Sold) as StockValue
Resident Test
Group by ModelID;
Expression in Text Box: sum(StockValue)





