Forum Discussion
Anonymous
6 years agoNot applicable
Decreasing by code and date
Hi, May I ask you if there is a possible way to do the same but for the decrease? If the code appears today but no longer tomorrow I want it to reflect it as a negative. Here I attached an ...
- 6 years ago
Hi,
According to your description, Please try this measure:
Measure = VAR a = CALCULATE ( SUM ( 'Table'[Values] ), FILTER ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] < MIN ( 'Table'[Date] ) && 'Table'[Date Code] IN DISTINCT ( 'Table'[Date Code] ) ) ) ) ) RETURN IF ( a = BLANK (), IF ( MAX ( 'Table'[Values] ) = BLANK (), BLANK (), 0 ), SUM ( 'Table'[Values] ) - a )The result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
v-gizhi-msft
Community Support
6 years agoHi,
According to your description, Please try this measure:
Measure =
VAR a =
CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
ALLSELECTED ( 'Table'[Date] ),
'Table'[Date]
= CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Date] < MIN ( 'Table'[Date] )
&& 'Table'[Date Code] IN DISTINCT ( 'Table'[Date Code] )
)
)
)
)
RETURN
IF (
a = BLANK (),
IF ( MAX ( 'Table'[Values] ) = BLANK (), BLANK (), 0 ),
SUM ( 'Table'[Values] ) - a
)The result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi