Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I must be having a brian cramp here....
I have a QVD that contains a field called Fiscal_Year. It has values like 2010, 2011, 2012, 2013. I always want to load only those rows for the most recent year, but I can't get it to work. It just throws an error and I have to re-open the .QVW. I just want to do this:
LOAD *
FROM MyData.QVD
WHERE Fiscal_Year=Max(Fiscal_Year);
Hi,
Try to use this code.
Maxi:
LOAD max(Fiscal_Year) as MaxYear
FROM MyData.QVD group by Fiscal_Year;
LET vMax=peek('MaxYear',0,'Maxi');
Drop table Maxi;
Data:
LOAD *
FROM MyData.QVD
WHERE Fiscal_Year='$(vMax)';
Hope this will help you.
Regards,
Nitin Jain
Hi
when u use max() /aggregaton function..u want to use group by clause..
Try like this
Where fiscal_year = 2013;
Hope it helps
Hi
If u don't know the maximum year..then try like this
Tab1:
Load * from myfilename.qvd;
Inner join
Load max(fiscal_year) as fiscal_year, primarykeyfield resident Tab1 group by primarykeyfield;
Hope it helps
Hi,
Try to use this code.
Maxi:
LOAD max(Fiscal_Year) as MaxYear
FROM MyData.QVD group by Fiscal_Year;
LET vMax=peek('MaxYear',0,'Maxi');
Drop table Maxi;
Data:
LOAD *
FROM MyData.QVD
WHERE Fiscal_Year='$(vMax)';
Hope this will help you.
Regards,
Nitin Jain
Thanks Nitin. You'd think it would simpler, but this works.