Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have the following set analysis
avg({<{birthyear={">1960"}>}birthyear)
or
avg({<birthyear={"<2000>1960"}>}birthyear)
Birth year is in a dimension table with associated facts.
I've been verifying the results and the avg is off.
Can set analysis use the same field for dimension and measure?
Hi,
your expression should work.
Can you post a sample where it does not work?
Maybe you expect different results because your bithyear field is shared between your dimension and fact tables having different numbers of occurrences in both or you mean to calculate some average of distinct birthyears avg(distinct birthyear)?
thanks
regards
Marco
Hi,
Set Analysis can use Same field for Dimension and measure.
But this scenario it wont give any result.
What measure you want to identify using this expression. Elaborate your requirement.
on average, what is the birth year of individuals born between 1960 and 2000
Ok.
You should be having a field for addressing individual row like PersonId/Row ID.
avg({<{birthyear={">1960"}>}PersonID)
Share the Table structure or sample data to dig more and find the exact expression
Hi,
your expression should work.
Can you post a sample where it does not work?
Maybe you expect different results because your bithyear field is shared between your dimension and fact tables having different numbers of occurrences in both or you mean to calculate some average of distinct birthyears avg(distinct birthyear)?
thanks
regards
Marco
I'm thinking that's the problem. The year is in the dimension, not the fact so any averaging is ignoring the detail.
We'll have to modify the script to attach birth year to the detail
Thanks
Please close your thread if your question is answered:
Qlik Community Tip: Marking Replies as Correct or Helpful
thanks
regards
Marco