Forum Discussion
King8James
4 years agoRegular Visitor
Dynamic sales based on slicer
Hello, I need to create a measure that gives the sales of the selected scenario (selected by users from slicer) then adds previous sales (called "fix"), for example if scenario starts from may,th...
- 4 years ago
Hi King8James ,
Please try:
new sales = VAR sce = SELECTEDVALUE ( forecast[Alternative] ) VAR _a = CALCULATE ( SUM ( 'Table'[Sales] ), FILTER ( 'Table', 'Table'[Alternative] = sce || 'Table'[Alternative] = "FIX" ) ) VAR _d = CALCULATE ( MIN ( 'Table'[Month] ), FILTER ( ALL ( 'Table' ), [Alternative] = sce ) ) RETURN IF ( MONTH ( MAX ( 'Table'[Month] ) ) >= MONTH ( _d ) && MAX ( 'Table'[Alternative] ) = "FIX", BLANK (), _a )Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jianboli-msft
Community Support
4 years agoHi King8James ,
Please try:
new sales =
VAR sce =
SELECTEDVALUE ( forecast[Alternative] )
VAR _a =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER ( 'Table', 'Table'[Alternative] = sce || 'Table'[Alternative] = "FIX" )
)
VAR _d =
CALCULATE (
MIN ( 'Table'[Month] ),
FILTER ( ALL ( 'Table' ), [Alternative] = sce )
)
RETURN
IF (
MONTH ( MAX ( 'Table'[Month] ) ) >= MONTH ( _d )
&& MAX ( 'Table'[Alternative] ) = "FIX",
BLANK (),
_a
)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
King8James
4 years agoRegular Visitor
Thanks it works !!!