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

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

Reply
Christianvs
Helper I
Helper I

Selecting value from different row

Hi

 

I got a table that looks like this:

Christianvs_0-1666698066166.png

 

My goal is to add a new column called NEWDIST where the DIST value is used unless there are rows with same ID. In that case it should use the DIST value of the of the ID with a blank REF. For the table here the result should look like:

Christianvs_1-1666698250902.png

I added the COUNT column to with find the duplicates in ID and tried to do an IF statement in a calculated column:

NEWDIST = IF( NOT( ISBLANK( Table[COUNT]) ),
   *FUNCTION THAT CHOOSES DIST FROM ROW 1*,
   MAX(Table[DIST]))
 
I tried using CALCULATE with a FILTER but I havent got it working. Anybody able to help me out?
If it is possible without first making the COUNT column that would be great, I just couldn't figure out how to do it without.
 
Thanks
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, 

I am not sure if the whole possible situations are considered, but seeing the sample provided above, I tried to create a calcualted column like below.

Please check the attached pbix file and the below picture.

 

Jihwan_Kim_0-1666699273968.png

 

 

New DIST CC =
IF (
    Data[Ref] = BLANK (),
    Data[DIST],
    MAXX (
        FILTER ( Data, Data[ID] = EARLIER ( Data[ID] ) && Data[Ref] = BLANK () ),
        Data[DIST]
    )
)

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, 

I am not sure if the whole possible situations are considered, but seeing the sample provided above, I tried to create a calcualted column like below.

Please check the attached pbix file and the below picture.

 

Jihwan_Kim_0-1666699273968.png

 

 

New DIST CC =
IF (
    Data[Ref] = BLANK (),
    Data[DIST],
    MAXX (
        FILTER ( Data, Data[ID] = EARLIER ( Data[ID] ) && Data[Ref] = BLANK () ),
        Data[DIST]
    )
)

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks a lot Jihwan_Kim! It solved my problem 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.