Forum Discussion
bstark1287
3 years agoHelper II
Calculate based on selected filter
I have a measure that returns the total [Net Value Adjusted] for 2022 based on [Invoice Created Date]. I want to change this measure to calulate the latest selected year and create another separate m...
- Anonymous3 years ago
Hi bstark1287
You can refer to the following example.
Invoiced RT CY Act Material Cost_2022= VAR _maxperYear = CALCULATE(YEAR(MAX('Raw Order Data'[Invoice Created Date])), VALUES('Raw Order Data'[Invoice Created Date].[Year])) RETURN CALCULATE( [Invoiced RT ACT Material Cost], YEAR('Raw Order Data'[Order Invoiced Date]) =_maxperYear )Invoiced RT CY Act Material Cost_2021= VAR _minperYear = CALCULATE(YEAR(MIN('Raw Order Data'[Invoice Created Date])), VALUES('Raw Order Data'[Invoice Created Date].[Year])) RETURN CALCULATE([Invoiced RT ACT Material Cost],YEAR('Raw Order Data'[Order Invoiced Date])=_minperYear )Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
3 years agoNot applicable
Hi bstark1287
You can refer to the following example.
Invoiced RT CY Act Material Cost_2022=
VAR _maxperYear =
CALCULATE(YEAR(MAX('Raw Order Data'[Invoice Created Date])),
VALUES('Raw Order Data'[Invoice Created Date].[Year]))
RETURN
CALCULATE( [Invoiced RT ACT Material Cost], YEAR('Raw Order Data'[Order Invoiced Date]) =_maxperYear )Invoiced RT CY Act Material Cost_2021=
VAR _minperYear =
CALCULATE(YEAR(MIN('Raw Order Data'[Invoice Created Date])),
VALUES('Raw Order Data'[Invoice Created Date].[Year]))
RETURN
CALCULATE([Invoiced RT ACT Material Cost],YEAR('Raw Order Data'[Order Invoiced Date])=_minperYear )
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
bstark1287
3 years agoHelper II
Anonymous I don't know why I didn't think of using a variable! Thank you!