Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD by Month with if condition

Hi guys,

I'm trying to calculate the YTD by month and display in chart all the month of the year.

What i want to achieve is the YTD by month from all regions where region=responsibleRegion;

I've this expression as a dimension:

=if(GetSelectedCount(Month) > 0, Month, if(GetSelectedCount(Week)>0, Week , if(GetSelectedCount(Day)>0,Day,Month)))

And what i've try in expressions was:

=Sum({$<Responsible={RaiserPlantID}>} Auth*XRATE2USD) ;

=sum({$<Year = {$(vYearToday)}, Month = {"<=$(vMonthToday)"}>} if(Responsible=RaiserPlantID ,Auth*XRATE2USD, 0));

//=sum(if(RaiserPlantID=Responsible,Auth*XRATE2USD ,0))

But none of the above expressions get's the right values when i select dates.

PS: another thing is when no date is selected i calculate all until now , but when a date i selected is calculated until the date.

4 Replies
Gysbert_Wassenaar

You'll have a hard time if you want to do this with expressions only. Somehow you need to calculate the YTD period for each month. That's easiest done with a helper table in the script. See this document for more information: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
Not applicable
Author

I've read the files you mentioned but i've no clue how to accomplish

rogerioqv
Creator II
Creator II

Fábio,

Podes compartilhar seu qvw para ajudarmos?

Abraços.

Not applicable
Author

Desculpa Rogerio mas nao posso pois é da empresa onde trabalho e eles são muito restritos com a informação, vou tentar fazer uma copia com informação dummy.

Sorry Rogerio but i cant, it's for my company and they are very restricted sharing info, i will make a copy filled with dummy data so you and Gysbert Wassenaar cant take a look.

Thank You