Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vikas_nandanwar
Creator II
Creator II

Average Inventory Calculation

Hi,

Avg( Aggr( Sum(Qtyl), Date))

The above expression worked to some extent.

Now When i am drilling down to the final date, Its not giving me the correct answer.

I have my data as -

    

DateDeptWorkCenterSub DeptQtyCo. CodeType
2-Jan-17MfgAPURE10ZZGold
2-Jan-17RMBKARAT30XXPlatinum
2-Jan-17MfgCPURE30YYSilver
2-Jan-17JWASPRUE20ZZPlatinum
2-Jan-17MfgDFIL40XXGold
2-Jan-17RMDBAG50YYSilver
3-Jan-17MfgACHK10WWPlatinum
3-Jan-17JWBFIL20VVGold
3-Jan-17MfgCFILWIP20WWGold
3-Jan-17JWBCHK10VVSilver
3-Jan-17RMCFIL30XXPlatinum
3-Jan-17RMBBAG30ZZPlatinum
3-Jan-17MfgACHK20YYSilver
4-Jan-17JWBFIL50VVGold
4-Jan-17MfgCFILWIP10WWGold
4-Jan-17RMBBAG20VVSilver
4-Jan-17MfgCFIL40XXPlatinum
4-Jan-17JWAAAG40ZZSilver
4-Jan-17MfgDFIL20WWGold
4-Jan-17RMAAAG10YYPlatinum

I need to check drill down on a single date say 2nd Jan = Total Inventory of Qty = 180

Note this is sample data and will contain data from 1st Jan to 31st Oct.


Thanks,

Vikas

26 Replies
vikas_nandanwar
Creator II
Creator II
Author

Sum(Total Qty) will give me the answer at the single date i.e. 2-Jan-17, But, when at a whole level say all 300 dates included, my data will sum total all numbers and will give me total of all the dates qty,

Anil_Babu_Samineni

But, when at a whole level say all 300 dates included, my data will sum total all numbers and will give me total of all the dates qty,

What does you mean?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikas_nandanwar
Creator II
Creator II
Author

I've tried this but this do not give me correct answer

vikas_nandanwar
Creator II
Creator II
Author

1.     My data has date wise inventory - Date Column

2.     Inventory is available in different department - Dept Column
3.     Department has Sub department and different Work Center - (Sub Dept) & (WorkCenter) Column

4.     Inventory nos are in Qty Column

5.     Co. is another department where it is bifurcated

6.     Type of metal is represented in Type Column (Gold, Silver, Platinum)

Now at a dashboard level  it should look like this with Avg(Aggr(Sum())) function.

Metal.jpg

But when i Drill down to a single date, say 1st Aug, I should get Total(Sum())

Thanks,

Vikas

Anil_Babu_Samineni

Perhaps this?

If(GetCurrentField(GroupName) = 'Date', Sum(TOTAL Qty), Sum(Qty))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikas_nandanwar
Creator II
Creator II
Author

How does GetCurrentField(GroupName) expression work?

Anil_Babu_Samineni

Will surely explain you, First check in your app further we can discuss more in detail. https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/FieldFunc...

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikas_nandanwar
Creator II
Creator II
Author

GetCurrentField Function is not active, Instead i am getting GetCurrentSelection

Anil_Babu_Samineni

Can you drill to Date and use same expression in Text box then let me know what you are getting, Meantime check vice versa. Don't worry about red wingy line in your expression. Go and continue as it is bug

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vikas_nandanwar
Creator II
Creator II
Author

Its giving me error in expression