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 post your expected output based on the Input screenshot or any sample input & output data will also be fine..
It should look like this after adjustments:
- PattemManohar8 years ago
Community Champion
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
- gbrmdc8 years agoFrequent Visitor
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])))