Forum Discussion

DPozo's avatar
DPozo
New Member
2 years ago
Solved

Problems with EARLIER

Hi everyone,

 

I got a table like this:

 

WEEKBELLREJECTED

1

11
121
112
123
2125
2226
214
222
210

 

I would like to measure whats the maximum total value for every bell by week.
For example: in the previous table, if I select "WEEK 1", the measure must show 4 (3+1 > 1+2). For "WEEK 2", the measure must show 29 (25+4 > 26 + 2).

I have this DAX code:

Value =
CALCULATE (
    SUM ( LEAKDETAILS[REJECTED] ),
    LEAKDETAILS[BELL] = EARLIER(LEAKDETAILS[BELL]),
    LEAKDETAILS[WEEK] = EARLIER(LEAKDETAILS[WEEK])
)
But I have an error in the EARLIER. 
  • Anonymous's avatar
    Anonymous
    2 years ago

    You can use a measure like this - taking the Top 1 descending

    Top1 = SUMX(
            TOPN(
                1,
                SUMMARIZE(
                        WeekBellRejected,
                        WeekBellRejected[Bell],
                        "TotalRejected", SUM(WeekBellRejected[Rejected])
                ),
                [TotalRejected], DESC
            ),
            [TotalRejected]
    )
     

5 Replies

    • DPozo's avatar
      DPozo
      New Member

      I don't understand your answer.

  • Anonymous's avatar
    Anonymous
    Not applicable
    Top1 = SUMX(
            TOPN(
                1,
                SUMMARIZE(
                        WeekBellRejected,
                        WeekBellRejected[Bell],
                        "TotalRejected", SUM(WeekBellRejected[Rejected])
                ),
                [TotalRejected], DESC
            ),
            [TotalRejected]
    )
     
  • Anonymous's avatar
    Anonymous
    Not applicable

    You can use a measure like this - taking the Top 1 descending

    Top1 = SUMX(
            TOPN(
                1,
                SUMMARIZE(
                        WeekBellRejected,
                        WeekBellRejected[Bell],
                        "TotalRejected", SUM(WeekBellRejected[Rejected])
                ),
                [TotalRejected], DESC
            ),
            [TotalRejected]
    )