Forum Discussion
anmattos
4 years agoAdvocate I
Accumulated Measure using EARLIER and Inactive Relationship
Dear colleagueas, I'm trying to make this measure work for the past couple of days, but it seems over my head. I tried many things explianed elsewhere about accumulated measures, but it seems my ...
- 4 years ago
anmattos Forgot the ALL
Total Approval = VAR __Rev = MAX('fDCA'[Rev]) VAR __Table = ADDCOLUMNS( DISTINCT(ALL('fDCA'[Rev])), "__TotalApprovals",[Total Approvals] ) RETURN SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals])
Greg_Deckler
4 years agoCommunity Champion
anmattos Forgot the ALL
Total Approval =
VAR __Rev = MAX('fDCA'[Rev])
VAR __Table =
ADDCOLUMNS(
DISTINCT(ALL('fDCA'[Rev])),
"__TotalApprovals",[Total Approvals]
)
RETURN
SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals])anmattos
4 years agoAdvocate I
Wow!!!
Thank you Greg_Deckler ! It worked! Now I´ll need more 3 days to understand it, but the problem is solved.
Thank you very much for your time!
- Greg_Deckler4 years agoCommunity Champion
anmattos Here's a walk-through:
Total Approval = VAR __Rev = MAX('fDCA'[Rev]) // Get the current value of Rev column in the current row VAR __Table = ADDCOLUMNS( DISTINCT('fDCA'[Rev]), // Since we are in a visual where there is a single value of Rev in context, override this and get all the values of the distinct values of Rev in a single column table. "__TotalApprovals",[Total Approvals] // Add the measure to this single column table and the values returned are for the individual Rev values in the current virtual table row. ) RETURN SUMX(FILTER(__Table,[Rev]<=__Rev),[__TotalApprovals]) // SUM up the measure in our virtual table but filter the table such that only "previous" rows are summed.