This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi all,
Hope you can share your wisdom with me and help me set up a column query for the following:
I'm trying to create a colum that tags the first visit of a user to a location. I have a date column, a location column and a user column.
What formula would I have to write up to get the output as in my screenshot?
Thanks in advance for your help on this one!
Solved! Go to Solution.
Hello @jeroenwmwillems ,
You can use the following DAX query for a calculated column:
Output =
VAR FirstVisitDate =
CALCULATE (
MIN ( Visits[Date] ),
FILTER (
Visits,
Visits[User] = EARLIER ( Visits[User] )
&& Visits[Location] = EARLIER ( Visits[Location] )
&& Visits[Date] <= EARLIER ( Visits[Date] )
)
)
VAR FirstVisitLocation =
CALCULATE (
MIN ( Visits[Location] ),
FILTER (
Visits,
Visits[User] = EARLIER ( Visits[User] )
&& Visits[Location] = EARLIER ( Visits[Location] )
&& Visits[Date] >= EARLIER ( Visits[Date] )
)
)
VAR SelectedUser = Visits[User]
RETURN
IF (
Visits[User] = SelectedUser
&& Visits[Date] = FirstVisitDate
&& Visits[Location] = FirstVisitLocation,
"First Visit",
"Follow up Visit"
)
Please try this and let me know if this didn't work.
Hello @jeroenwmwillems ,
You can use the following DAX query for a calculated column:
Output =
VAR FirstVisitDate =
CALCULATE (
MIN ( Visits[Date] ),
FILTER (
Visits,
Visits[User] = EARLIER ( Visits[User] )
&& Visits[Location] = EARLIER ( Visits[Location] )
&& Visits[Date] <= EARLIER ( Visits[Date] )
)
)
VAR FirstVisitLocation =
CALCULATE (
MIN ( Visits[Location] ),
FILTER (
Visits,
Visits[User] = EARLIER ( Visits[User] )
&& Visits[Location] = EARLIER ( Visits[Location] )
&& Visits[Date] >= EARLIER ( Visits[Date] )
)
)
VAR SelectedUser = Visits[User]
RETURN
IF (
Visits[User] = SelectedUser
&& Visits[Date] = FirstVisitDate
&& Visits[Location] = FirstVisitLocation,
"First Visit",
"Follow up Visit"
)
Please try this and let me know if this didn't work.
Thanks heaps for this, that worked!
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 13 | |
| 11 | |
| 8 | |
| 8 | |
| 7 |
| User | Count |
|---|---|
| 38 | |
| 27 | |
| 25 | |
| 22 | |
| 22 |