Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm wrestling with this problem: I've defined a market with set analysis and I want to get the min Year where sum(Amount) > 0 as a variable. Does anyone know how I would do this?
So my set analysis looks like:
sum({<Company=,Location={'$(vLocation)'}>}Amount)
I thought I would do something like this:
FirstSortedValue(Year,aggr(if(sum({<Company=,Location={'$(vLocation)'}>}Amount)>0,1,0),Year))
But for some reason, the above expression returned an incorrect year.
Is this expression correct or are there other ways?
Thanks.
I believe I got it to work with the following:
=Min(if(aggr(SUM({<Company, Location = {'$(vLocation)'}>}Amount),Year)>0,Year),Year)
May be this:
Min({<Year = {"=Sum({<Company, Location = {'$(vLocation)'}>} Amount) > 0"}>}Year)
=sum(
{$<
Location = {"=sum({1<Location = {$(vLocation)}>}Amount)>0"}
,Company =
>}
Amount)
The vLocation variable:
=Concat({$<Location = {'Location1*'}>}Location, ', ')
The result:
The example is attached.
UPDATE: sorry, misunderstood the issue.
This didn't seem to work, but thank you for replying
Did it give anything? or did you get an error in syntax? Would you be able to provide a sample with expected output?
I believe I got it to work with the following:
=Min(if(aggr(SUM({<Company, Location = {'$(vLocation)'}>}Amount),Year)>0,Year),Year)
The text object gave me a ' - ' . I think I have a solution now
Hi
Is it like ..
if(Aggr(sum({<Company=,Location={'$(vLocation)'}>}Amount)>0,Min(year))