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 experts.
Problem:
Trying to create calculated column that looks up which store user used in their first purchase and populate column with that data.
Wanted outcome:
USER_ID | PURCHASE_DATE | STORE_NAME | FIRST_STORE_NAME (wanted outcome) |
1 | 1.1.2020 | A | A |
1 | 2.1.2020 | B | A |
1 | 3.1.2020 | B | A |
2 | 1.1.2020 | C | C |
2 | 2.1.2020 | B | C |
2 | 3.1.2020 | C | C |
3 | 1.1.2020 | A | A |
3 | 2.1.2020 | A | A |
3 | 3.1.2020 | C | A |
Solved! Go to Solution.
@MikaelB , Create a new column like
New column =
var _max = Minx(filter(Table, [USER_ID] = earlier([USER_ID])),[PURCHASE_DATE])
return
[Value] -maxx(filter(Table, [PURCHASE_DATE] = _max && [USER_ID] = earlier([USER_ID])),[STORE_NAME])
Hey @MikaelB ,
you should get the result with the following calculated column:
FIRST_STORE_NAME =
VAR vRowUser = myTable[USER_ID]
VAR vFirstPurchase =
CALCULATE(
MIN( myTable[PURCHASE_DATE] ),
ALLEXCEPT(
myTable,
myTable[USER_ID]
)
)
RETURN
CALCULATE(
MIN( myTable[STORE_NAME] ),
myTable[USER_ID] = vRowUser,
myTable[PURCHASE_DATE] = vFirstPurchase,
ALL( myTable )
)
@MikaelB , Create a new column like
New column =
var _max = Minx(filter(Table, [USER_ID] = earlier([USER_ID])),[PURCHASE_DATE])
return
[Value] -maxx(filter(Table, [PURCHASE_DATE] = _max && [USER_ID] = earlier([USER_ID])),[STORE_NAME])
This worked. Thank you for the solution. Danced around this the whole day 🙂
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.