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
I have a table of user event names and adhoc info; Some of the events have adhoc info that needs to be used to set a conditional column values for all other rows that have same user ID. How do I create a DAX function to dynamically set the column value?
| EventName | UserId | Adhoc1 | Adhoc2 | UserType | Status |
| PageLoaded | 1 | Product1 | |||
| SubmitButtonClicked | 1 | NewUser | |||
| TransactionCompleted | 1 | ||||
| PageLoaded | 2 | Product1 | |||
| PageLoaded | 3 | Product2 | |||
| SubmitButtonClicked | 3 | ExistingUser |
The desired result
| EventName | UserId | Adhoc1 | Adhoc2 | UserType | Status |
| PageLoaded | 1 | Product1 | NewUser | Success | |
| SubmitButtonClicked | 1 | NewUser | NewUser | Success | |
| TransactionCompleted | 1 | NewUser | Success | ||
| PageLoaded | 2 | Product1 | NewUser | Bailed | |
| PageLoaded | 3 | Product2 | ExistingUser | Success | |
| SubmitButtonClicked | 3 | ExistingUser | ExistingUser | Bailed |
Conditional column "UserType" -
Table.AddColumn(#"Sources", "UserType", each if Text.StartsWith([EventName], "SubmitButtonClicked") then [Adhoc2] else if (Filter(Table, AllExcept[UserId], ??)) else null)
Conditional column "Status" -
Table.AddColumn(#"Sources", "Status", each if [UserId] == LATER??[UserId] then "Success" else "Bailed")
Thank you for help!
Could you please clarify more details/logic about dax statement below in your custom function?
Filter(Table, AllExcept[UserId], ??)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I was able to solve the first question with below DAX and create a new column
UserTypeGenerated = IF(CALCULATE(COUNTROWS(TableName),ALLEXCEPT('TableName',TableName[UserId]),TableName[UserType]="ExistingUser")>0,"ExistingUser","NewUser")
However, I still need help with the second one. @v-yuta-msft Can you help?
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.