Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DPozo
New Member

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. 
1 ACCEPTED SOLUTION
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]
)
 

View solution in original post

5 REPLIES 5
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]
)
 

It works perfectly! Thanks!
Anonymous
Not applicable

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

Use TOPN function with Top 1 - TOPN function (DAX) - DAX | Microsoft Learn

I don't understand your answer.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.