Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
96 | |
72 | |
44 | |
38 | |
29 |
User | Count |
---|---|
156 | |
92 | |
61 | |
44 | |
42 |