Forum Discussion
Help with Expression
- 6 years ago
Hi antoniodneto ,
You can create this measure:
Measure = VAR _max = CALCULATE ( MAX ( 'Table'[date] ), ALLSELECTED ( 'Table'[date] ) ) RETURN IF ( ISFILTERED ( 'Table'[date] ), IF ( _max IN DISTINCT ( 'Table'[date_sell] ), CALCULATE ( SUM ( 'Table'[value] ), FILTER ( ALL ( 'Table' ), 'Table'[date_sell] = MAX ( 'Table'[date_sell] ) ) ) ), SUM ( 'Table'[value] ) )no date is selectedselected date
Attached a sample file that hopes to help you: Help with Expression.pbix
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
So, when I select month by month the expression works. When I dont select any month the value is the same if I select 2007 (my max date). I would like to accumulate all the values for DATE_SELL when I don`t select any month.
Sorry if my explanation is not clearly.
Hi antoniodneto ,
You can create this measure:
Measure =
VAR _max =
CALCULATE ( MAX ( 'Table'[date] ), ALLSELECTED ( 'Table'[date] ) )
RETURN
IF (
ISFILTERED ( 'Table'[date] ),
IF (
_max IN DISTINCT ( 'Table'[date_sell] ),
CALCULATE (
SUM ( 'Table'[value] ),
FILTER ( ALL ( 'Table' ), 'Table'[date_sell] = MAX ( 'Table'[date_sell] ) )
)
),
SUM ( 'Table'[value] )
)no date is selectedselected date
Attached a sample file that hopes to help you: Help with Expression.pbix
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.