Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Dynamic calculation in text statements

HelHi All,   Can you please help me on one more thing I am looking for something like below a brand sale 98 Percent  from Asia b brand sales 80 percent from Europe  Here each text statement has ...
  • nandukrishnavs's avatar
    6 years ago

    Anonymous 

     

    You can use selectedvalue() to get the brand or area. https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/

    Example

    message =
    VAR _brand =
        CALCULATE (
            SELECTEDVALUE ( 'Table'[brand] )
        )
    VAR _sales = [Sales] //sales measure
    VAR _area =
        CALCULATE (
            SELECTEDVALUE ( 'Table'[area] )
        )
    VAR _message = _brand & " sale " & _sales & " Percent from " & _area
    RETURN
        _message



    Did I answer your question? Mark my post as a solution!
    Appreciate with a kudos
    🙂