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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
nj17
Helper III
Helper III

Incorrect Date format in Text box

Hi All,

I am creating a measure which returns date in textbox as below

nj17_0-1611839027239.png

 but it returns date as 01-16-2021

 

nj17_1-1611839131578.png

 

how can I get date as 01/16/2021

@amitchandak 

Thanks

10 REPLIES 10
v-easonf-msft
Community Support
Community Support

Hi, @nj17 

Could you please tell me whether your problem has been solved?
If yes, you could accept the helpful answer as solution. You also could share your own solution here. For now, there is no content of description in the thread. If you still need help, please share more details to us.

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PhilipTreacy
Super User
Super User

Hi @nj17 

I presume you are actually using a Card visual, not a Text Box?

I can't reproduce the problem.  But I don't know how you are creating the [_Title test] measure.  Is it a date?

I also don't understand how the date in [_Title test] is 01/16/2021 yet in [_Title] the format is reversed to 2021-01-16 yet the code you show isn't altering [_Title test]. ARe we missing some piece of the puzzle here?

All I can think is that because you aren't doing an explicit conversion to text - assuming [_Title test] is a date - it is formating it in some default way.

So try doing an explicit conversion using FORMAT()

Also you can simplify your measure to this

 

_Title = "Dashboard " & "(as of " & FORMAT([_Title test], "mm-dd-yyyy" & ")")

 

Here's my PBIX if you want to check out my code to create the date and visual..

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy 

 

below is the screenshot of your pbix which you shared,here also i can see the same issue.

Or is Power BI using system date formate?

nj17_0-1611938511150.png

 

HI, @nj17 

 

I can't see any issue on my side.Please check my sample file for more details.

_Title test = FORMAT(LASTDATE('Table'[Date]),"MM/DD/YYYY")
_Title =
VAR weenkenddate = [_Title test]
RETURN
    "Dashboard" & "as of(" & weenkenddate & ")"

9.png

Can you share your sample file for testing?

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @nj17 

There's no issue there, the dates are displayed as they should be.

The measure _Title test just displays a date without any applied formatting so it takes the default format which for you is mm/dd/yyyy

The measure _Title creates a string and formats _Title test to use - as separators so you are seeing mm-dd-yyyy   

To display the date with / as separator just change the measure _Title to this

_Title = "Dashboard " & "(as of " & FORMAT([_Title test], "mm/dd/yyyy" & ")")

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


nj17
Helper III
Helper III

@PhilipTreacy @mahoneypat 

 

kindly see below image where date formate changed automatically 

 

nj17_0-1611845792149.png

 

PhilipTreacy
Super User
Super User

Hi @nj17 

I'm curious, in your measure FORMAT is using // as separators so that's what you should get.

We can't see the rest of your code, what's after the RETURN?

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy 

 

see below image I am using this measure in title of a textbox

nj17_0-1611843230450.png

 

mahoneypat
Microsoft Employee
Microsoft Employee

You can try "MM/dd/yyyy" instead, or you can not use FORMAT, highlight the measure and select the desired format in the ribbon.

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi @mahoneypat 

I tried "MM/dd/yyyy" but it didnt help.I can not select formate of this measure as date as it returns text and date.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.