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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bergen288
Helper III
Helper III

Why are there extra spaces in a measure shown in text box?

I am trying to create a measure to show the updated date in my report.  At first, my measure is MTD_DATE = "MTD Through " &  FORMAT(TODAY()-1, "DDDDDD").  But my report is to be refreshed around 10am daily so it might cause confusion if someone takes a look of my report before daily refresh.  So I decided to create a SQL table (DTR_mtd_date) with MTD date in text format and import it to Power BI.  See screenshot below.

bergen288_0-1664898783237.png

My 2nd measure is MTD_Date2 = "MTD Through" & MIN(DTR_mtd_date[mtd_date]).  However, when it is added into Text Box, there aer some extra spaces after "MTD Through" as shown below.  There are no such extra spaces when it is shown in table visaul.  What's wrong with it and how to fix it?  Let me know if you need my pbix file for investigation.

bergen288_1-1664899033049.png

 

Thanks.

1 ACCEPTED SOLUTION
bergen288
Helper III
Helper III

After playaround with DAX text functions, here is my solution: MTD_Date2 = "MTD Through " & TRIM(MIN(DTR_mtd_date[mtd_date])).  The extra spaces are trimmed as shown below:

bergen288_0-1664910796897.png

 

View solution in original post

5 REPLIES 5
bergen288
Helper III
Helper III

After playaround with DAX text functions, here is my solution: MTD_Date2 = "MTD Through " & TRIM(MIN(DTR_mtd_date[mtd_date])).  The extra spaces are trimmed as shown below:

bergen288_0-1664910796897.png

 

bergen288
Helper III
Helper III

Another option is to put my MTD_Date2 measure into card visual.  It also has extra spaces with source spacing enabled.  Fortunately, the extra spaces is removed with source spacing disabled.  However, text in card visaul is always center aligned.  How may I left align text in card visual?

 

bergen288_0-1664906576670.png

 

Sorry, I just remembered that card visual has a bug that this measure can't be displayed correctly in Power BI Mobile.  So card visual is not an option.

amitchandak
Super User
Super User

@bergen288 , Please use the format in the measure too. Auto conversion of date to text might have added that space

 

MTD_Date2 = "MTD Through" & FORMAT(MIN(DTR_mtd_date[mtd_date]),"DDDDDD")

I have updated: MTD_Date2 = "MTD Through" & FORMAT(MIN(DTR_mtd_date[mtd_date]),"DDDDDD").  But it still has extra spaces after "MTD Through".

bergen288_0-1664904299479.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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