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: 
lgutierrez
Contributor III
Contributor III

How can i get the year average for the products sold just in the last month?

Hi Experts

I have a simple table with 3 columns

1- Product

     =Product

2- Sales average for current month

     =Avg({<Month={$(=max(month))}>}Sales)

3- Sales average for the year

     =Avg({<Month=>}Sales)

My problem is when I remove the month, I also see products sold in othe months.

Question:

How can i get the just the year average for the products sold just in the last month?

(extample Attached

prouducts without Avg Jun, are from other months, i need removed them from the table).

Thanks in advance

Regards.

7 Replies
jaumecf23
Creator III
Creator III

Hi,

Maybe you can do something like this:

=if(Avg({<Month={$(=max(month))}>}Sales)>0,Avg({<Month=>}Sales))

sunny_talwar

You can also use this

=Avg({<Month, Product = {"=Avg({<Month = {$(=max(month))}>}Sales) <> 0"}>}Sales)

lgutierrez
Contributor III
Contributor III
Author

Thank you very much for your feedback...

However it doesn't work...

thanks.

lgutierrez
Contributor III
Contributor III
Author

Thanks Sunny

however it don't work.

the script don't come back anything.

but I appreciate your attention

thaks.

sunny_talwar

Would you be able to share a sample?

lgutierrez
Contributor III
Contributor III
Author

tabla1.pngtabla2.png

lgutierrez
Contributor III
Contributor III
Author

In the first table, I sow the products for the last month. and in the second I need the total year average for the products, but just for the products in the first table.

the problem is when i add the Acum column with the avg for the year, I get also products for other months.