Forum Discussion

AviramWeiss's avatar
AviramWeiss
Icon for Helper I rankHelper I
3 years ago
Solved

Returning values on slicer bounds

Hello all, This is a basic question, but I wasn't able to solve it on my own or find a working solution. I have a table containing date, name and value: Date Name Value Nov 1, 2022 AAA 2...
  • FreemanZ's avatar
    FreemanZ
    3 years ago

    hi AviramWeiss 

    Aha, the Date column of the slicer shall come from an independent Date Table with this code:

    DateTable = CALENDAR(MIN(TableName[Date]), MAX(TableName[Date]))
     
    And change the code for the measures to:
    StartValue =
    VAR MinDate = MIN (DateTable[Date])
    RETURN
    CALCULATE(
        SUM(TableName[Value]),
        TableName[Date] = MinDate
    )
    EndValue =
    VAR MaxDate = MAX (DateTable[Date])
    RETURN
    CALCULATE(
        SUM(TableName[Value]),
        TableName[Date] = MaxDate
    )
    Total =
    VAR MinDate = MIN (DateTable[Date])
    VAR MaxDate = MAX (DateTable[Date])
    RETURN
    CALCULATE(
        SUM(TableName[Value]),
        TableName[Date] >= MinDate
             &&TableName[Date] <= MaxDate
    )
    i tried and it now worked like this: