Forum Discussion
Fill a column based on a value in two other columns
- 8 years ago
You need to add the column using that expression in "Data" pane using "New Column" NOT in "Power Query Editor".
Also please note in the below expression LookupValue is name of the table I've stored sample data, in your case it should be your tablename. As LookupValue is a DAX keyword as well, that's why it was mentioned in single quote (I might have used another name to avoid confusion)
Check = CALCULATE(MAX('LookupValue'[Answer]),FILTER(ALL('LookupValue'),'LookupValue'[Question]="Location" && 'LookupValue'[ResponseID] = EARLIER([ResponseID])))
Could you please try the following...
Add a "New Column" using below expression...
Check = CALCULATE(MAX('LookupValue'[Answer]),FILTER(ALL('LookupValue'),'LookupValue'[Question]="Location" && 'LookupValue'[ResponseID] = EARLIER([ResponseID])))
InputOutput
Dear PattemManohar,
Thanks for your help!
I am getting a "token literal expected" error when I try to add this formula:
If I click on "show error", it points to the first apostrophe on 'LookupValue'
Regards,
Gabriel
- PattemManohar8 years ago
Community Champion
You need to add the column using that expression in "Data" pane using "New Column" NOT in "Power Query Editor".
Also please note in the below expression LookupValue is name of the table I've stored sample data, in your case it should be your tablename. As LookupValue is a DAX keyword as well, that's why it was mentioned in single quote (I might have used another name to avoid confusion)
Check = CALCULATE(MAX('LookupValue'[Answer]),FILTER(ALL('LookupValue'),'LookupValue'[Question]="Location" && 'LookupValue'[ResponseID] = EARLIER([ResponseID])))
- gbrmdc8 years agoFrequent Visitor
- PattemManohar8 years ago
Community Champion
As mentioned above, use your table name in place of "LookupValue" (It is the table name I've created for testing your scenario)
- gbrmdc8 years agoFrequent Visitor
- PattemManohar8 years ago
Community Champion
You are welcome !! Gabriel :smileyhappy:
- mhennes15 years agoFrequent Visitor
Hello!
I am having an issue with this expression in my application. I am looking to do essentially the same thing as OP, I have a report with survey data and each row is a different question. The individual surveys are identified by column "Survey Invitation ID" -- I would like to create a new column that fills with the answer to one of the questions based off of the survey ID (i.e. if customer fills out Survey ID 1 and indicates that they work at a university, the new column would identify each row labeled as Survey ID 1 as being a university customer). However, when I tried to use the formula provided in this post I am getting some false results. Attached is a screenshot of what the Survey ID column looks like, as well as the results of the new formula. The second Survey ID with 3 associated rows does not have a response value, but the formula is populating results regardless.