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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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