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
Green_G
Frequent Visitor

Populate a new column with data from conditional row

Hi,

 

I am new to Power BI report building and I'm hoping you can help - I'm sure there is a simple solution but I don't know what it is!

 

I have a table like the one below and want to create an additional column called "ORIGINAL SOURCE" that shows the value in the SOURCE column for EVENT NO 1 in every row for the relevant REF VALUE.

 

REFEVENT_NOSOURCE
0011A
0012A
0013B
0014B
0015D
0021C
0022D
0023A
0024B
0025C
0026D

 

So it will look like this:

REFEVENT_NOSOURCEORIGINAL SOURCE
0011AA
0012AA
0013BA
0014BA
0015DA
0021CC
0022DC
0023AC
0024BC
0025CC
0026DC

 

I would appreciate anyone's advice on the best way to achieve this.

 

Many Thanks,

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@Green_G  you can write a measure like this

Measure2 = 
//what is the min event # by REF
VAR one =
    CALCULATE (
        MIN ( 'Table 1'[EVENT_NO] ),
        ALL ( 'Table 1' ),
        VALUES ( 'Table 1'[REF] )
    ) // what is the source when event = one by ref
VAR two =
    CALCULATE (
        MIN ( 'Table 1'[SOURCE] ),
        FILTER (
            ALL ( 'Table 1' ),
            'Table 1'[EVENT_NO] = one
                && 'Table 1'[REF] = MAX ( 'Table 1'[REF] )
        )
    )
RETURN
    two

 

smpa01_0-1702322885384.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

1 REPLY 1
smpa01
Super User
Super User

@Green_G  you can write a measure like this

Measure2 = 
//what is the min event # by REF
VAR one =
    CALCULATE (
        MIN ( 'Table 1'[EVENT_NO] ),
        ALL ( 'Table 1' ),
        VALUES ( 'Table 1'[REF] )
    ) // what is the source when event = one by ref
VAR two =
    CALCULATE (
        MIN ( 'Table 1'[SOURCE] ),
        FILTER (
            ALL ( 'Table 1' ),
            'Table 1'[EVENT_NO] = one
                && 'Table 1'[REF] = MAX ( 'Table 1'[REF] )
        )
    )
RETURN
    two

 

smpa01_0-1702322885384.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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