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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Multiple columns cannot be converted to a scalar value (with format function)

Hi,

I have a table (A) with titles of books and their reading time as duration.
I have a second table (B) with reading times as provided by the publisher.
The relationship between the tables is based on table and is many to one.

Table A looks like this:
customer 1 - bookA - reading time (duration)
customer 2 - bookA - reading time (duration)
customer 3 - bookB - reading time (duration)

Table B looks like this:
bookA - expected reading time (duration)

bookB - expected reading time (duration)
bookC - expected reading time (duration)

In the Power Query editor I already transformed both of the reading time columns to duration by using this:
Tabel1 = Table.TransformColumnTypes(Tabel1_Table,{{"reading time", type time}}),
DateTimeToDuration = Table.TransformColumns(Tabel1,{{"reading time", each _ - #time(0,0,0), type duration}})

With the FORMAT function I transformed to reading time from table A to a text value and calculated the average with:

avgTime = FORMAT(
AVERAGE('reading time'[reading time]); "HH:MM:SS")


Now I also need to format the expected reading times from table B. But since those are just 1 per book title it has no use to use something like AVERAGE. Something like ALL in combination with FORMAT gives me the above in the title of this post mentioned error. 

Any ideas?
Many thanks!



1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Anonymous,

AFAIK, current power bi does not support duration type of values.
I'd like to suggest you convert it to total second and write a calculated field to transform the total second to text value with duration strings. (you can aggeration on the total second field)

Aggregating Duration Time  

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @Anonymous,

AFAIK, current power bi does not support duration type of values.
I'd like to suggest you convert it to total second and write a calculated field to transform the total second to text value with duration strings. (you can aggeration on the total second field)

Aggregating Duration Time  

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
parry2k
Super User
Super User

@Anonymous you need to add this as a column to Format value on Table B, if you adding as a measure then use some aggregated function like MIN or MAX and then you will not get this message. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.