Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ankitg4688
Contributor III
Contributor III

Current Month current Quarter and Last Month of Previous Quarter

Hi,

I am trying to calculate sales of Maximum month of User selected Quarter and sales of Last month of Previous Quarter. Users will be selecting Quarters every time and expression should fetch sum of sales accordingly. Can anyone help? Thanks.

8 Replies
tresesco
MVP
MVP

Could you post a qvw with sample data?

shraddha_g
Partner - Master III
Partner - Master III

Calculate Monthname field from Date as Monthname(DateField) as Monthname

In set analysis you can try,

for maximum month of selected quarter

Monthname = {"$(=text(monthname(max(DateField))))"}

For Last month of Previous Quarter

Monthname = {"$(=text(monthname(addmonths(QuarterStart(max(DateField)),-1))))"}

ankitg4688
Contributor III
Contributor III
Author

Sorry, I cannot upload qvw here but I can explain my scenario. I have Calendar columns:-  Year, Quarter, Month Number, PeriodID and QuarterID. In my dashboard I am giving Year, Quarter and Month List boxes for User selection.

User selection

1.  When User selects Year from Year Listbox then,

sum(Selected Year) Sales + Sum (Previous Year) Sales -- This is working fine.

2.  After Year Selection, User selects Quarter from Quarter Listbox then,

sum(Selected Quarter's  Maximum Month) sales +  sum(Previous Quarter's Maximum Month) sales -- Unable to get

3. After Year and Quarter Selection, User selects Month from Month Listbox then

sum(Selected Month) Sales + Sum (Previous Month) Sales -- Unable to get

ankitg4688
Contributor III
Contributor III
Author

Hi Shraddha,

Can you please also check above scenario which I mentioned? Thanks.

tresesco
MVP
MVP

May be like this?

2.  Sum ({<Year=,...>}   <your expression >)        // exclude year selection

3.  Sum ({<Year=,Quarter=,...>}   <your expression >)     // exclude year and quarter selection

ankitg4688
Contributor III
Contributor III
Author

Hi Tresesco,

Yes, I am looking for Set expression.

Year should be preselected before selecting quarter. Thanks.

tresesco
MVP
MVP

Without your qvw with sample data it would be very hard now to help you further.

ankitg4688
Contributor III
Contributor III
Author

Hi Tresesco,

Thanks for help. I have found the solution for this. I will be posting it soon so that it will help others.