Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
yvonne-c
Creator
Creator

Yearly expression calculation

Sum({<[Target Weight]={600},Class-={Nil},Date>}Aggr(Sum({<Date>}Quantity)/Only({<Date>}[Calculated Cow Course])/Only({<Date>}RangeAvg(NumCows15,NumCows14))/209,Product,ReferredTo,Year)) 

I am using the above expression to create the following chart

Capture.JPG

Instead of  calculating on a range of the years  '/Only({<Date>}RangeAvg(NumCows15,NumCows14))/'   I want each column to divide by the NumCow figure for that year

Can anybody help me with the expression for this?

I have a NUMCOW figure for each year

or- even better could it be done from a list of individual animals - a count of all the animals for all the years in a list (with a field 'count date')

Thanks

5 Replies
sunny_talwar

It should already be doing that, is it not? Can you share a sample with the expected output you wish to see?

yvonne-c
Creator
Creator
Author

I don't want to divide by an average of the years,  I want to  divide by the number of cows in each year

so I have the no of cows in a table like this:

Farm Nocows15Nocows14
Farm A141132
Farm B439247
Farm C158182
Farm D157156

Sum({<[Target Weight]={600},Class-={Nil},Date>}Aggr(Sum({<Date>}Quantity)/Only({<Date>}[Calculated Cow Course])/ Only({<Date>}RangeAvg(NumCows15,NumCows14))/209,   (I want this part to divide by the Total of Nocows15 for 2015 or total of Nocows14 for 2014 and so on)

Product,ReferredTo,Year))


Does that make sense?!


Thanks


sunny_talwar

I am still not certain that I understand what you want, can you may be share you qvw to look at?

yvonne-c
Creator
Creator
Author

Sum({<[Target Weight]={600},Class-={Nil},Date>}Aggr(Sum({<Date>}Quantity)/Only({<Date>}[Calculated Cow Course])/Sum({<[Age, months]={">24"},Year=>}(Totalanimal)),Product,ReferredTo,Year))

I've nearly got this to work with the above expression, using a list of animals.

Sum({<[Age, months]={">24"},Year=>}(Totalanimal)),

The problem I have now is that its dividing by ALL of the Totalanimal, I just want it to divide by the sum of those animals with a 'Countdate' in that year


structure.JPG
Does that make sense now?!

Thanks

Anil_Babu_Samineni

Can you explain more with dummy data and expected o/p. So that, We might get clue to solve your issue

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