Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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.
| REF | EVENT_NO | SOURCE |
| 001 | 1 | A |
| 001 | 2 | A |
| 001 | 3 | B |
| 001 | 4 | B |
| 001 | 5 | D |
| 002 | 1 | C |
| 002 | 2 | D |
| 002 | 3 | A |
| 002 | 4 | B |
| 002 | 5 | C |
| 002 | 6 | D |
So it will look like this:
| REF | EVENT_NO | SOURCE | ORIGINAL SOURCE |
| 001 | 1 | A | A |
| 001 | 2 | A | A |
| 001 | 3 | B | A |
| 001 | 4 | B | A |
| 001 | 5 | D | A |
| 002 | 1 | C | C |
| 002 | 2 | D | C |
| 002 | 3 | A | C |
| 002 | 4 | B | C |
| 002 | 5 | C | C |
| 002 | 6 | D | C |
I would appreciate anyone's advice on the best way to achieve this.
Many Thanks,
Solved! Go to Solution.
@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
@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
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 17 | |
| 10 | |
| 7 | |
| 6 |