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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
jeyare
Helper II
Helper II

Offset + Match (Excel) equivalent in DAX

In a learning mode,  can't find a solution for this example (simplified). Thank you for your tip.

 

to column "Index W":

- I need to MATCH the nearest greater value from "Weight B" for each evaluated row value of "Age A"

- then I need to write the value of "Weight A" matched

 

In Excel it is easy done by:

OFFSET(A1, MATCH(Age A, Age B , 1 ), 1)

 

Sample:

Age AWeight AAge BIndex W
1.0101.1 
1.2203.2 
3.6303.7 

 

Expected result:

Age AWeight AAge BIndex W
1.0101.120
1.2203.230
3.6303.7blank
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Index W = 
MAXX(
    TOPN(
        1,
        FILTER( DATA, DATA[Age B] > EARLIER( DATA[Age B] ) ),
        DATA[Age A], ASC
    ),
    DATA[Weight A]
)

Screenshot 2021-09-05 145051.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
jeyare
Helper II
Helper II

Thx gents for the advice.

CNENFRNL
Community Champion
Community Champion

Index W = 
MAXX(
    TOPN(
        1,
        FILTER( DATA, DATA[Age B] > EARLIER( DATA[Age B] ) ),
        DATA[Age A], ASC
    ),
    DATA[Weight A]
)

Screenshot 2021-09-05 145051.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Jihwan_Kim
Super User
Super User

Hi,

The below is for creating a calculated column.

 

Picture1.png

 

Index W CC =
VAR _ageB = Data[Age B]
VAR _condition =
MINX ( FILTER ( Data, Data[Age A] > _ageB ), Data[Age A] )
RETURN
CALCULATE ( SUM ( Data[Weight A] ), FILTER ( Data, Data[Age A] = _condition ) )

 

Link to the sample pbix file 

 

 


 

    Microsoft MVP




If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.





LinkedIn
Visit my LinkedIn page





Outlook Booking
Schedule a short Teams meeting to discuss your question.




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.