Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
sogloqlik
Creator III
Creator III

Aggr + Stdev by Material Group

Hi,

I got the following request from the business:

for each Material Group, how many of the last 6 days had a complaint count greater than the Material Group’s rolling 12-month average + standard deviation.

My current measure is:

Count(
    {<
        [Complaint Open Date] =
        {">=$(vLast6Days)<=$(vMaxComplainDate)"}
    >}
    Aggr(
        If(
            Count(
                Distinct
                {<
                    [Classification 1] = {'Contact Complaint'}
                >}
                [Complaint Number]
            )
            = $(vAvgAndStdevCompGeneral),
            1
        ),
        [Complaint Open Date]
    )
)

The variable vAvgAndStdevCompGeneral is currently:

(
    (
        Aggr(
            Count(
                Distinct
                {<
                    [Classification 1] = {'Contact Complaint'}
                >}
                [Complaint Number]
            ),
            [Material Group Code]
        )
    )
    /
    Count(
        {<
            [Material Group Code] =,
            [Material Group] =
        >}
        Distinct [Complaint Open Date]
    )
)
+
Stdev(
    Aggr(
        Count(
            {<
                [Classification 1] = {'Contact Complaint'},
                COMP_isWorkingDay = {'1'}
            >}
            [Complaint Number]
        ),
        [Complaint Open Date]
    )
)

The measure works when I select one Material Group, but not when Material Group is used as a dimension in a table.

I now also need the average to be based on a rolling 12-month period, while the final count should still evaluate only the last 6 days.

How should I modify the expression so that the calculation works independently for every Material Group in the table?

 

Thx

Labels (1)
0 Replies