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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
cparker4486
Helper III
Helper III

LEFT function doesn't accept a calculated 2nd parameter value

Datetime2 = VAR Length = INT(LEN('Verizon Wireless'[Datetime]) - 5)
    RETURN LEFT('Verizon Wireless'[Datetime], Length) & ":" & 
RIGHT('Verizon Wireless'[Datetime], 5)

 

I'm importing CSV data that comes from Verizon Wireless. PBI is mangling their Time column so I'm having to do a few steps to parse it out manually (most of these steps are not shown).

 

The above column definition is my final step in this process. Once this column can be created I expect I should be able to convert the type of the column from Text to Datatime.

 

The problem is that LEFT() won't accept a 2nd parameter that's been dynamically calculated. If I type a value in, it works fine. The problem is that this is not possible because the left portion I want is a variable length.

 

I also tried running the calculation through INT() thinking that might solve it but I had the same problem.

 

Here's a screenshot of the formula, data, and error message. What am I doing wrong here?

 

Lastly, using the first record as an example, the output in Datetime2 would be "12/22/2017 3:19 PM".

 

Screenshot

1 ACCEPTED SOLUTION
cparker4486
Helper III
Helper III

As is usually the case, I found the answer a few minutes after finally giving up and posting my question in a forum.

 

Not every column in Datetime has data so LEN() is returning an error on those columns. This has pointed out some other datetime shenanigans in Verizon's data so I'm going to have to take a different approach.

View solution in original post

1 REPLY 1
cparker4486
Helper III
Helper III

As is usually the case, I found the answer a few minutes after finally giving up and posting my question in a forum.

 

Not every column in Datetime has data so LEN() is returning an error on those columns. This has pointed out some other datetime shenanigans in Verizon's data so I'm going to have to take a different approach.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.