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: 
BartVA
Creator
Creator

Count products where average value is not zero

Hello,

I have a table with (among others) the fields Date, Product, Stock.

I also have a Master Calendar table with Date, YearWeek, YearMonth, and so on.

I need a chart that shows:

  • X-axis: YearWeek (with alternatives YearMonth, etc.)
  • Y-axis: in plain English "the number of distinct products where the average Stock for the given period in the chart (eg. YearWeek or YearMonth) is different from 0, divided by the total number of products"

How do I make the Master Measure for this? Many thanks in advance!

I've been messing around with aggr but can't seem to get it right...

1 Solution

Accepted Solutions
rubenmarin

Hi, maybe with: Count(Distinct Aggr(If(Avg(Stock)<>0, Product), YearWeek,Product))/Count(distinct Product)

View solution in original post

2 Replies
rubenmarin

Hi, maybe with: Count(Distinct Aggr(If(Avg(Stock)<>0, Product), YearWeek,Product))/Count(distinct Product)

BartVA
Creator
Creator
Author

Yes, great! Thank you!