Forum Discussion
Cumulative Percentage
- 7 years ago
So you're very close. ALLSELECTED returns all values that are currently being used in the table. You just need to add an extra filter statement that specifically calls out blank month of closure as something you don't want included in this measure.
Cumulative Total = CALCULATE ( COUNT ( 'Actual v Expected'[Count] ), FILTER ( ALLSELECTED ( 'Actual v Expected' ), ('Actual v Expected'[MONTH_OF_CLOSURE] <= MAX ( 'Actual v Expected'[MONTH_OF_CLOSURE] ) &&
('Actual v Expected'[MONTH_OF_CLOSURE] <> BLANK()) ) ))
Hi Arranafc19 ,
We can create measures as below.
Measure =
VAR a =
MAX ( 'Table'[Month] ) - 1
RETURN
IF (
a <> 0,
CALCULATE (
SUM ( 'Table'[percentage] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month] = a )
)
)
Measure 2 =
CALCULATE (
SUMX ( 'Table', [Measure] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month] <= MAX ( 'Table'[Month] ) )
)
Hi v-frfei-msft
That didn't quite work as required, however maybe if I give a bit more context on my dataset , it may make more sense.
The table I am working off is called 'Comparison' and is made up of the below fields:
-> Month of closure which is calculated in the sql query by getting the datediff between the start and end date.
-> Count - this is creating when I grouped my dataset in power bi to count the number of rows per month of closure.
-> percentage closure -> how I am currently calculating the percetnage closed per month of closure using the below measure :
- Cmcmahan7 years agoResident Rockstar
So you're happy with how Percentage Closure is currently being calculated? If your only issue is setting up the cumulative sum of percentages to ignore blank values, we can do that.
Cumulative % =
SUMX(
FILTER(
ALLSELECTED(Comparison),
Comparison[Month] <> BLANK() &&
Comparison[Month] <= SELECTEDVALUE(Comparison[Month])
),
[Percentage Closure]
)- Arranafc197 years agoHelper IV
Hi Cmcmahan
This didnt work for me, see my measure below amended to suit my dataset
When I do this I get the following:
My dataset is called 'Actual v Expected' and i mention about the measure I am using for the PercentageClosed column.
Any ideas why this isn't working as required ?
- v-frfei-msft7 years agoCommunity Support
Hi Arranafc19 ,
Could you please share your sample data to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.