Right a bit of a headache here.
I basically wanted to create a cumulative total of a percentage through a query.
To put that in a more physical way:
Where the / signifies a divide to get a percentage. The 9 is just the total of the frequency.
Anyway microsoft provide a way of doing this from their article here:
However, their formula fails to work in one particular scenario.
The ms formula is:
Which is basically using DSum on the fields to produce the cumulative percentages. The issue is if you have two values that are both the same the [ProductSales]>= will not work correctly.
Here is an example:
This is also incorrect for:
The problem is that because it is looking for a value >= to be running the DSUM it just cant do it when there are two of the same values.
Does anyone have a suggestion of how this can be done correctly?
I basically wanted to create a cumulative total of a percentage through a query.
To put that in a more physical way:
Code:
NCTYPE Freq cpercent x 2 2/9 y 3 5/9 z 4 9/9
Anyway microsoft provide a way of doing this from their article here:
However, their formula fails to work in one particular scenario.
The ms formula is:
Code:
CumPct: DSum("[ProductSales]","tblSalesByCategory", _
"[ProductSales]>=" & [ProductSalesTotal] _
& "")/DSum("[ProductSales]","tblSalesByCategory")
Here is an example:
Code:
Type freq cpercent x 2 100% y 2 100%
This is also incorrect for:
Code:
Type freq cpercent x 2 0.5 y 1 1 z 1 1
The problem is that because it is looking for a value >= to be running the DSUM it just cant do it when there are two of the same values.
Does anyone have a suggestion of how this can be done correctly?
Comment