Multiple Measures to give me a running rate

Ian_20210927

New Member
Joined
Sep 27, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi. I have created 3 matrix tables (below). The first sums the KS (this stands for school key stages) per day. The second table is the running 7 days sum of those daily totals. And the third table is that 7 day total/divided by denominator *100000

For some reason the third table doesn't do the maths unless something is added or subtracted from the 7 day running sum. If the 7 day total stays the same on the next day (and is a zero in the daily table), it erroneously defaults to zero in the third table when there will/may be daily totals for some of the other days in the 7 days period. I don't understand why it's doing this, because it works fine other than that last bit. Thanks for taking the time, Ian

dZPgg.png

The measure I'm using to get the daily total:

Code:
M3 =
VAR result =
    CALCULATE (
        COUNT ( Project4_data[Key Stage]),
        FILTER (
            ALLSELECTED ( Project4_data ),
            [Specimen Date] IN VALUES ( Project4_data[Specimen Date] )
                && [Key Stage] IN VALUES ( 'BreakthroughTable'[Key Stage] )
        )
    )
RETURN
    IF ( result <> BLANK (), result, 0 )

7 day running sum measure:

Code:
7 Day Sum of Cases =
Var WeekCount =
CALCULATE([M3],
FILTER( ALL( Project4_data[Specimen Date]),
Project4_data[Specimen Date] > MAX( Project4_data[Specimen Date]) - 12 &&
Project4_data[Specimen Date] <= MAX(Project4_data[Specimen Date]) -5 ))
RETURN
IF(
WeekCount = BLANK(),
0,
WeekCount)

And the measure to work out the rate per 100,000:

Code:
Key Stages 7D Rate =
VAR KS7DRate =
DIVIDE([7 Day Sum of Cases], [KS Denominator])*100000
RETURN
IF(
KS7DRate = BLANK(),
0,
KS7DRate
)
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I should add that I've been pulling my hair out for days and am now totally bald. Thanks for looking, Ian
 
Upvote 0
Hi again, I've worked out that it must be the lookup I use to pick which denominator to use. The denominators are in a table:

Denominators Denominators are picked using a measure which filters the first column to the correct KS -

Code:
KS Denominator =
Var KSDnom =
CALCULATE(
SUM(KS_Denom[KS Denominators]),
        FILTER (
            ( KS_Denom ),
            [Key Stage] IN VALUES ( 'BreakthroughTable'[Key Stage] )
        )
    )
RETURN
    IF ( KSDnom <> BLANK (), KSDnom, 0 )

So I'm getting closer - but still not over the line :(
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top