cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

POwe Bi Report Builder - Date/time Conversion failed

Hi There, 

 

I'm starting to use Power Bi report builder. When I try to view my report I keep on getting the error below.

 

Annemie19_0-1604920175351.png

 

My query is shown below. As soon as I replace the @ProjEndDate and @ProjStartDate with '2020-03-31', '2020-04-15' respectively the report works. 

 

SELECT
d.[DealID]
,d.[DealNumber]
,d.[PreviousDealNo]
,d.[NextDealNo]
,d.[PayMethod]
,d.[PayBranch]
,d.[PayAccountNumber]
,d.[NoOfShares]
,d.[NominalAmount]
,CONVERT( date,d.[IssueDate],103) As Issue_Date
,CONVERT( date,d.[RedemptionDate],103) As RedemptionDate
,d.[SecurityDescription]
,d.[CertifiecNos]
,d.[CertificateHeldWhere]
,d.[TypeOfClass]
,d.[CaptureDate]
,CONVERT( date,d.[RiskDate],103) As RiskDate
,CONVERT( date,d.[CreditDate],103) As CreditDate
,CONVERT( date,d.[ManagementDate],103) As ManagementDate
,CONVERT( date,d.[ReleaseDate],103) As ReleaseDate
,CONVERT( date,d.[ProjectionDate],103) As ProjectionDate
,d.[UserID]
,d.[NetCapitalChanges]
,d.[CurrentNominalAmount]
,d.[PayBranchCode]
,d.[PayAccountHolder]
,d.[DealType]
,d.[BankName]
,d.[LastInterestType]
,s.Name AS SubsidiaryName
,s.RegNo AS [Subsidiary RegNo]
,cp.Name AS CounterpartyName
,cp.CTitle1
,cp.CName1
,cp.CSurname1
,cp.CSurname2
,cp.PAddress1
,cp.PAddress2
,cp.PAddress3
,cp.PPostCode
,CONVERT( date,ProjStartDate,103) AS ProjStartDate
,CONVERT( date,ProjEndDate,103) AS ProjEndDate
,ProjectedAmount

FROM [InfoMart_FinancialProducts].[dbo].[VwPrefSharesDeal] d

JOIN [dbo].[VwPrefSharesSubsidiary] s on s.SubsidiaryHashKey = d.SubsidiaryHashKey
JOIN [dbo].[VwPrefSharesCounterparty] cp on cp.CounterpartyHashKey = d.CounterpartyHashKey
JOIN [dbo].[VwPrefSharesCashProjection] c on c.DealHashKey = d.DealHashKey

WHERE DealID =@DealID
AND CONVERT( date,ProjStartDate,103) = @ProjStartDate
AND CONVERT( date,ProjEndDate,103)= @ProjEndDate

 

Can someone please assist with this error?

 

Kind Regards,

Annemie

1 ACCEPTED SOLUTION

@amitchandak  - I found the problem. My parameter data type was set to text and not date/time

View solution in original post

3 REPLIES 3
Super User IV
Super User IV

@Annemie19 , any reason you are converting dates to text? bring them directly



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

@amitchandak  - I found the problem. My parameter data type was set to text and not date/time

View solution in original post

@amitchandak  - Are you referring to the CONVERT( date,... it just added this before because I thought that it might be the problem. But even without the CONVERT( date,.. it still gives the same error. 

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors