Forum Discussion

kalkhudary's avatar
kalkhudary
Helper IV
3 years ago
Solved

Isblank if nothing selected on a visual

  Hello Community,    I am struggling to write this formula that shows the last year price index when I click on the visual for a particular city and if I don;t click on any, it should give me bl...
  • jennratten's avatar
    3 years ago

    Hello - You were really close.  The measure below works for me.  Basically, you should create a separate measure for LastYearPriceIndex with the basic logic of calculating the amount for the prior year (excluding the blank evaluation).  Then create another measure which is the one that goes in the visual (example below).  You will need to update the table and column name in the SelectedCity variable and also update measure name in the SelectedCalculation variable.

    Last Year Price Index for Display = 
    VAR SelectedCity = SELECTEDVALUE( DimTableName[CityColumnName],blank() )
    VAR SelectedCalculation = [YourMeasureName]
    VAR Result = if ( SelectedCity = blank(), blank(), SelectedCalculation )
    RETURN
        Result