1
votes

Problem:

Create a running total measure that does not reference any calculated columns, only measures.

One measure is a calculation. Another measure is auto-incrementing IDs created from a RANKX.

The goal is to create a running total measure/sum for A using reference only to B.

Context: For data restriction reasons, there is no ability to add a calculated column. Therefore, there are a number of measures that have been created.

Existing trials:

Existing knowledge base (internet searches) only seem to refer to measures where there is a mixture of columns and measures. There is no ability to add calculated columns, however, nor need for/use of existing columns within this particular running total.

Currently there has been an attempt to use a table expression to build the table with the measures, creating additional variables for a max (MAXX) and trying to filter this way and use a CAlCULATE in the return. This is only returning the total and not a running total.

Edit:

Example table:

[...existing cols] Measure A Measure B (Needed) Measure C
... 10 1 10
... 60 2 70
... 40 3 110

Measure A is a sum of other measures Measure B is a rank of other measures Measure C is a running total of measure A given Measure B

1
I'd recommend providing an example toy data table and corresponding measure to work with rather than requiring responders to invent them to answer.Alexis Olson
is the RANKX measure given? if not what's the criteria for it?Stachu
@Alexis Olson, edited original question. The measures consist of other measures, I did not want to conflate the underlying question. Hope this helps.DJLH
@Stachu , good question. It exists within one of the existing measures to provide a ranking. The current attempt is a rolling total using only these measures. Hopefully the additional table in the edit provides some context.DJLH

1 Answers

2
votes

The basic pattern for this is:

CumulativeMeasureA =
VAR CurrentRank = [MeasureB]
RETURN
    SUMX ( FILTER ( ALL ( Data[Group] ), [MeasureB] <= CurrentRank ), [MeasureA] )

Where Data[Group] is the column that you are grouping on in your report visual.


Note that this isn't very efficient without calculated columns since it is having to compute [MeasureB] for every Group for every row in your visual, filter those results, and compute [MeasureA] every iteration that isn't filtered out. For small datasets, this isn't a problem but can be as things get larger and more complex.