Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Custom text based on average column values

Hello I'm new to Power BI, please excuse any faux pas.   Currently I have visuals (card and gauge) that display the average value of a numerical columns. Values in this column are between 0 and 10 ...
  • danextian's avatar
    3 years ago

    Hi Anonymous ,

     

    That is possible  using DAX but I would transform your raw data into a format that is easier for reporting. Below aer a sample formulas (as a measure). The second one explictily specifies the range

    Text = 
    VAR __AVG =
        CALCULATE ( AVERAGE ( 'Table'[Value] ) )
    RETURN
        SWITCH ( TRUE (), __AVG > 6.5, "positive", __AVG <= 4, "negative", "neutral" )
    
    Text2 = 
    VAR __AVG =
        CALCULATE ( AVERAGE ( 'Table'[Value] ) )
    RETURN
    SWITCH ( TRUE(),
    __AVG >=0 && __AVG <=4, "negative",
    __AVG >4 && __AVG <=6.5, "neutral",
    __AVG >6.5 && __AVG <=10, "positive"
    )
    

    Please see attaced pbix for details