Forum Discussion
Calculated Column - Return value if two columns matches
Hi!
I have a problem that seems simple but I just can't seem to solve it.
I'm trying to return Hours to a Calculated Column if Start Date and Date matches as in the example below:
I've tried both CALCULATE and IF but both returns errors:
CALCULATE(SUM([Hours]);[Date] = [Start Date])
IF([Start Date] = [Date];[Hours];"")
Help would be much appreciated!
Marcus
- Anonymous8 years ago
Hi
Can you try this ?
New Column = IF(Table1[Start Date] = table1[Date],[Hours])
Let me know if you see any issues.
Thanks
Raj
- Anonymous8 years ago
Anonymous
I think the solution by Anonymous would work. You might be getting the error in your IF statement because you are setting the ELSE condition as "". This will probably cause an error because [Hours] is a number and "" is text. You can either use rajendran's version or you can switch the "" with BLANK()
Hope this helps,
Parker
5 Replies
- AnonymousNot applicable
Hi
Can you try this ?
New Column = IF(Table1[Start Date] = table1[Date],[Hours])
Let me know if you see any issues.
Thanks
Raj
- AnonymousNot applicable
Thanks for the reply but that is basically the same IF-formula that I have been trying and I receive an error.
Does this work for you?
Regards
Marcus
- AnonymousNot applicable
Anonymous
I think the solution by Anonymous would work. You might be getting the error in your IF statement because you are setting the ELSE condition as "". This will probably cause an error because [Hours] is a number and "" is text. You can either use rajendran's version or you can switch the "" with BLANK()
Hope this helps,
Parker