cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
wfarm
Frequent Visitor

Right Pad Text record values with spaces

I have a text field that I'm using for matrix columns.

I'd like to pad each value to a maximum length of 25.

I am not finding a function to do this.

 

Is there a way to right pad a text field?

 

Thanks

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @wfarm ,

 

Maybe a measure can be used to solve this.

I created a matrix with a simple.

Matrix at the beginning.

vcgaomsft_0-1644824223065.png

The longest number here is 999999999.So I created a measure to represent the width of the column I want. Put it into the matrix.

 

widths = 123456789

 

vcgaomsft_2-1644824709330.png

Then turn of the Auto-size width.

vcgaomsft_1-1644824322426.png

Replace widths with values.

vcgaomsft_4-1644827084591.png

Attach the pbix file for reference.

Hope it helps.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @wfarm ,

 

Maybe a measure can be used to solve this.

I created a matrix with a simple.

Matrix at the beginning.

vcgaomsft_0-1644824223065.png

The longest number here is 999999999.So I created a measure to represent the width of the column I want. Put it into the matrix.

 

widths = 123456789

 

vcgaomsft_2-1644824709330.png

Then turn of the Auto-size width.

vcgaomsft_1-1644824322426.png

Replace widths with values.

vcgaomsft_4-1644827084591.png

Attach the pbix file for reference.

Hope it helps.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

wfarm
Frequent Visitor

Thanks Greg.

 

My situation is that I want to build a matrix with this field becoming the column. The number of values will change from monmth-to month. I can set the column width now and turn off "Auto-fit" on the column settings but then next month I may get a value in a record that is longer and then it stretched out and doesn;t automatically wrap. I was hoping that if I set a maximum length and then kept auto-wrap on, the new values, along woth the previously seen values, would all be the same width.
Am I missing something?
Is there another way to deal with this so that my column widths remain constant?

 

THanks!

Greg_Deckler
Super User
Super User

@wfarm Perhaps a Custom Format String. Otherwise, you could do this:

Measure = 

  VAR __Text = MAX('Table'[Column])

  VAR __Len = LEN(__Text)

  VAR __Rept = 25 - __Len

RETURN

  REPT(" ",__Rept) & __Text

 

Or perhaps I am not understanding.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors