Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

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

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

Hi,

Maybe you can do something like this:

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

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

You can also use this

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

lgutierrez
New Contributor III

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

Thank you very much for your feedback...

However it doesn't work...

thanks.

lgutierrez
New Contributor III

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

Thanks Sunny

however it don't work.

the script don't come back anything.

but I appreciate your attention

thaks.

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

Would you be able to share a sample?

lgutierrez
New Contributor III

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

tabla1.pngtabla2.png

lgutierrez
New Contributor III

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

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.

Community Browser