Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
AvPowerBI
Post Patron
Post Patron

Calculated Column Issue - Single Value

Hi,

 

I am trying to write a calculated column based on the following logic:

IF Description from the Type Table is equal to "First Day" or "Second Day"  THEN how many Minutes between StartDateTime and EndDateTime from the Call Fact table,

IF Minutes between StartDateTime and EndDateTime is greater than 480 minutes then set this to 45 minutes 

ELSE set this to number of minutes between StartDateTime and EndDateTime

 

I thencreated a Calculated Column with the below DAX forumula : 

 

TimeTaken =

IF('Type'[Description] IN {"First Day","Second Day"},
DATEDIFF('Call Fact'[StartDateTime], 'Call Fact'[EndDateTime], MINUTE),
IF(DATEDIFF('Call Fact'[StartDateTime], 'Call Fact'[EndDateTime], MINUTE) > 480, 45,
DATEDIFF('Call Fact'[StartDateTime], 'Call Analysis'[EndDateTime], MINUTE)))

 

 

But I get the following error message:

 

A single value for column 'Description' in table 'Type' 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.

 

Any ideas?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AvPowerBI ,

 

You will need to define StartDateTime and EndDateTime in the Type table first.

Please check the following formula.

Column = 
var _start = LOOKUPVALUE('Call Fact'[StartDateTime],'Call Fact'[id],'Type'[id])
var _end = LOOKUPVALUE('Call Fact'[EndDateTime],'Call Fact'[id],'Type'[id])
var _diff = IF('Type'[Description] IN {"First Day","Second Day"},DATEDIFF(_start,_end,MINUTE))
return
IF(_diff>480,45,_diff)

4.PNG

5.PNG

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @AvPowerBI ,

 

You will need to define StartDateTime and EndDateTime in the Type table first.

Please check the following formula.

Column = 
var _start = LOOKUPVALUE('Call Fact'[StartDateTime],'Call Fact'[id],'Type'[id])
var _end = LOOKUPVALUE('Call Fact'[EndDateTime],'Call Fact'[id],'Type'[id])
var _diff = IF('Type'[Description] IN {"First Day","Second Day"},DATEDIFF(_start,_end,MINUTE))
return
IF(_diff>480,45,_diff)

4.PNG

5.PNG

 

Best Regards,

Jay

amitchandak
Super User
Super User

@AvPowerBI , You can not use second table like that. Depending on relation

 

IF(related('Type'[Description]) IN {"First Day","Second Day"},
DATEDIFF('Call Fact'[StartDateTime], 'Call Fact'[EndDateTime], MINUTE),
IF(DATEDIFF('Call Fact'[StartDateTime], 'Call Fact'[EndDateTime], MINUTE) > 480, 45,
DATEDIFF('Call Fact'[StartDateTime], 'Call Analysis'[EndDateTime], MINUTE)))

 

or

 

IF(maxx(relatedtable('Type'),[Description]) IN {"First Day","Second Day"},
DATEDIFF('Call Fact'[StartDateTime], 'Call Fact'[EndDateTime], MINUTE),
IF(DATEDIFF('Call Fact'[StartDateTime], 'Call Fact'[EndDateTime], MINUTE) > 480, 45,
DATEDIFF('Call Fact'[StartDateTime], 'Call Analysis'[EndDateTime], MINUTE)))

 


Also, refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.