Forum Discussion

WOLFIE's avatar
WOLFIE
Helper I
2 years ago
Solved

Selecting MIN and MAX values

Hi

 

I need to display the selected age in my report. I've tried these 2 options, however this always shows only the min and max values from the table. So for example when I select age 14 - 24 and apply many other filters, these numbers will change picking the mi and max value from the table, rather than displaying what the user picked in the filter.

IF(ISFILTERED('Table'[Age]),"| Age: "& MINX(ALLSELECTED('Table'),'Table'[Age]) &" - "& MAXX(ALLSELECTED('Table'),'Table'[Age]) &" ")
 
IF(ISFILTERED('Table'[Age]),"| Age: "& MIN('Table'[Age]) &" - " & MAX('Table'[Age]) & " ")
  • I managed to solve it myself πŸ™‚

    VAR MinAge =
        CALCULATE(
            MIN('Table'[Age]),
            ALLSELECTED('Table')
        )
    VAR MaxAge =
        CALCULATE(
            MAX('Table'[Age]),
            ALLSELECTED('Table')
        )
    RETURN
        IF(
            ISFILTERED('Table'[Age]),
            "| Age: " & MinAge & " - " & MaxAge,
            BLANK()
        )

     

2 Replies

  • I managed to solve it myself πŸ™‚

    VAR MinAge =
        CALCULATE(
            MIN('Table'[Age]),
            ALLSELECTED('Table')
        )
    VAR MaxAge =
        CALCULATE(
            MAX('Table'[Age]),
            ALLSELECTED('Table')
        )
    RETURN
        IF(
            ISFILTERED('Table'[Age]),
            "| Age: " & MinAge & " - " & MaxAge,
            BLANK()
        )