Forum Discussion
Incorrect Date format in Text box
Hi Anonymous
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
- Anonymous5 years agoNot applicable
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?
- PhilipTreacy5 years agoSuper User
HI Anonymous
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
- v-easonf-msft5 years agoCommunity Support
HI, Anonymous
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 & ")"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.