Forum Discussion
newpbiuser01
1 year agoHelper V
Using Filter with a Calculate Function Based on a Condition
Hello, Would anyone know if I can apply an if statement to whether or not the calculate function applies a filter? As an example, I'm trying to say, test = VAR _Category = SELECTEDVALUE ( 'T...
- 1 year ago
How about this formula below?
test =
VAR _Category = SELECTEDVALUE ( 'Table1'[VALUE] )
RETURN
IF ( _Category <> "All",
SUMX ( FILTER('Table2', 'Table2'[CATEGORY] = _Category), 'Table2'[TOTAL SAVINGS] ),CALCULATE ( SUM ( 'Table2'[TOTAL SAVINGS] ), ALLSELECTED ( 'Table2'[CATEGORY] ))
)
mickey64
1 year agoSuper User
How about this formula below?
test =
VAR _Category = SELECTEDVALUE ( 'Table1'[VALUE] )
RETURN
IF ( _Category <> "All",
SUMX ( FILTER('Table2', 'Table2'[CATEGORY] = _Category), 'Table2'[TOTAL SAVINGS] ),
CALCULATE ( SUM ( 'Table2'[TOTAL SAVINGS] ), ALLSELECTED ( 'Table2'[CATEGORY] ))
)