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
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
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.