Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
I'm trying to add a calculated column to calculate the number of days between two dates. However, I need to only calculate for those that meet a certain criteria.
The formula I tried is:
DiffCloseDate = if(Opportunities[Status]="won",(Opportunities[Actual Close Date]-Opportunities[Est Close Date]),"")
For the 'then' clause, I also tried
Datediff(Opportunities[Est Clsoe Date],Opportunities[Actual Close Date],Days)
The error I'm receiving is:
A single value for column 'Actual Close Date' in table Opportunities cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
But, I don't want to aggregate the dates. I just want each row to perform the calculation.
Thanks for any help.
Solved! Go to Solution.
Are you sure that you are using a calculated column because the error you are getting is for a measure. If you use a calculated column, your formula would generate an error regarding "variant" data because you are trying to return a number and a string at the same time. Both have to agree in terms of the data type returned. So, you could do something like this as a calculated column (not a measure)
DiffCloseDate = IF(Opportunities[Status]="won",Opportunities[Actual Close Date]-Opportunities[Est Close Date],-999)
Are you sure that you are using a calculated column because the error you are getting is for a measure. If you use a calculated column, your formula would generate an error regarding "variant" data because you are trying to return a number and a string at the same time. Both have to agree in terms of the data type returned. So, you could do something like this as a calculated column (not a measure)
DiffCloseDate = IF(Opportunities[Status]="won",Opportunities[Actual Close Date]-Opportunities[Est Close Date],-999)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
54 | |
31 | |
30 | |
30 | |
24 |
User | Count |
---|---|
47 | |
45 | |
19 | |
16 | |
14 |