Forum Discussion

gabrielefugazzi's avatar
5 years ago
Solved

MAX FUNCTION AND SLICER VALUE

My report contains a filter (titled ANNO) on which the user is able to select specific years from the data. The currenly selected value is 'Ultimi 2 anni' which means 'Last two years'. Applying this ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi gabrielefugazzi,

    It seems like you are facing the find out the previous record in the discontinued table based on conditions, right?

    If this is the case, I think you can extract the current date and calculate with a fixed numerical value should not suitable for our conditions.

    You need to use condition and current date to filter on your table records to get a list of records, then extract the maximum one of them and this one should meet the previous records requirement.

     

    Measure=
    VAR currdate =
        MAX ( fatturato[anno_fattura] )
    VAR prevdate =
        CALCULATE (
            MAX ( fatturato[anno_fattura] ),
            FILTER (
                ALL( fatturato ),
                [anno_fattura] < currdate
                    && 'other conditions'
            )
        )
    RETURN
        'your formula'
    

     

    For measure on total level calculations, you can refer to the below blog:

    Measure Totals, The Final Word 

    Regards,

    Xiaoxin Sheng