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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

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

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.