Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

SELECTED VALUE While unselect

Team

I have filter table = List[levels)

if list(levels) selected then the dax formula works if unselect filter then it showing as blank data

my question here is if filter applied then show filter data else show ALL.. what is DAX Formula ?

 

VAR _mod = SELECTEDVALUE('List'[Levels])


RETRUN CALCULATE(-SUM('Data'[amount])/1000000,
'GPS'[File] =_mod,
'GPS'[File2] ="CDS"
)

  • Hi Anonymous  - you can modify your DAX to check if a selection exists in 'List'[Levels]. If a filter is applied, it should use the selected value

     

    VAR _mod = SELECTEDVALUE('List'[Levels])

    RETURN
    CALCULATE(
    -SUM('Data'[amount]) / 1000000,
    'GPS'[File] = IF(ISBLANK(_mod), 'GPS'[File], _mod),
    'GPS'[File2] = "CDS"
    )

     

    please check the above and hope it works.

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Try:

    VAR _mod = SELECTEDVALUE('List'[Levels])
    
    VAR _result = 
      IF( _mod = BLANK(),
        CALCULATE(-SUM('Data'[amount])/1000000, 'GPS'[File2] ="CDS"),
        CALCULATE(-SUM('Data'[amount])/1000000, 'GPS'[File] =_mod, 'GPS'[File2] ="CDS" )
      )
    RETURN
      _result
  • Hi Anonymous  - you can modify your DAX to check if a selection exists in 'List'[Levels]. If a filter is applied, it should use the selected value

     

    VAR _mod = SELECTEDVALUE('List'[Levels])

    RETURN
    CALCULATE(
    -SUM('Data'[amount]) / 1000000,
    'GPS'[File] = IF(ISBLANK(_mod), 'GPS'[File], _mod),
    'GPS'[File2] = "CDS"
    )

     

    please check the above and hope it works.