Forum Discussion
Anonymous
5 years agoNot applicable
Calculating cumulative excluding certain values depending on the certain dates
Dear Friends, I hope you are all doing well. I am working on the following subject and I am having issue how to make formula which will calculate cumulative headcounts but for the certain months whe...
- 5 years ago
Hi Anonymous ,
Modify your measure as below:
Actual HC YTD2 = VAR _tab = CALCULATETABLE ( VALUES ( 'Maternity'[Current Date] ), FILTER ( ALL ( Maternity ), 'Maternity'[Cost Center] = MAX ( 'Maternity'[Cost Center] ) && 'Maternity'[Maternity] = "M" ) ) RETURN CALCULATE ( SUM ( 'HC'[qty] ), FILTER ( ALL ( Dates ), Dates[Date] <= MAX ( Dates[Date] ) ) ) - CALCULATE ( SUM ( 'HC'[qty] ), FILTER ( 'HC', 'HC'[Start Date of Employment] IN _tab ) )And you will see:
Check the related .pbix file attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
v-kelly-msft
Community Support
5 years agoHi Anonymous ,
Modify your measure as below:
Actual HC YTD2 =
VAR _tab =
CALCULATETABLE (
VALUES ( 'Maternity'[Current Date] ),
FILTER (
ALL ( Maternity ),
'Maternity'[Cost Center] = MAX ( 'Maternity'[Cost Center] )
&& 'Maternity'[Maternity] = "M"
)
)
RETURN
CALCULATE (
SUM ( 'HC'[qty] ),
FILTER ( ALL ( Dates ), Dates[Date] <= MAX ( Dates[Date] ) )
)
- CALCULATE (
SUM ( 'HC'[qty] ),
FILTER ( 'HC', 'HC'[Start Date of Employment] IN _tab )
)
And you will see:
Check the related .pbix file attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Anonymous
5 years agoNot applicable
Dear Kelly,
Thank you very much ! It works !