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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
MauricioHV
New Member

Matrix with text and numbers

I have a Matrix like this.

MauricioHV_0-1752259320501.png

The original table was unpivot, so the plot values are coming for the final unpivot column "Value".
However, in this column I have mixed text and numbers (the laboratory and the value itself).

I want to mantain the format as number in order to ease future calculus, however, the text don't allow that.
Is there any way I can have both formats? Text and numbers?   

Thanks and greetings to everyone

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @MauricioHV 

 

You cannot maintain the number format of a column if any of its value is non-number. Number + Number = Number while Number + Text =Text. What you can do is create a custom column in the query editor that returns only the rows that are numbers. Example

// Attempt to convert [text_number column] to a number; return null if conversion fails
try Number.From([text_number column]) otherwise null

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
danextian
Super User
Super User

Hi @MauricioHV 

 

You cannot maintain the number format of a column if any of its value is non-number. Number + Number = Number while Number + Text =Text. What you can do is create a custom column in the query editor that returns only the rows that are numbers. Example

// Attempt to convert [text_number column] to a number; return null if conversion fails
try Number.From([text_number column]) otherwise null

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @MauricioHV 


Just wanted to follow up on your question regarding the matrix visual, where your unpivoted "Value" column contains a mix of text and numbers which is affecting formatting and future calculations.

 

The community has @danextian @Ashish_Mathur  already shared a few suggestions to help separate or manage the mixed data types. If you’ve had a chance to try those solutions, it would be great to hear how it’s working for you!

 

If you're still facing issues with keeping number formatting intact while preserving textual values, feel free to share more details about your data structure  we’re happy to dive deeper and assist further.

Looking forward to your update!

Hi @MauricioHV 

Just checking in on your matrix visual issue where your "Value" column mixes numbers and text, causing formatting trouble and making calculations tricky.

 

Community experts like @danextian @Ashish_Mathur have already offered some suggestions to help separate the data types. If you've tried them, we'd love to hear how things are going!

 

If the problem persists and number formatting is still getting lost alongside textual values, feel free to provide more details about your data setup we're here to dive deeper and help out.

 

Looking forward to hearing back from you!

Hi @MauricioHV 

Just following up on your question about handling mixed data types (text and numbers) in the unpivoted "Value" column of your matrix.

As mentioned earlier by @danextian @Ashish_Mathur , Power BI doesn’t allow a single column to store both text and numeric types while preserving number formatting for calculations. The recommended approach is to:

  • Split the column into separate fields—one for numeric values (for calculations) and another for text (like laboratory names).

  • Use conditional logic or DAX formatting to handle display needs while preserving numeric integrity for calculations.

Let us know if you’ve had a chance to apply this solution or if the issue still persists we're happy to assist further if needed!

 

If we don’t hear back, we may close this thread in line with our community guidelines, but you’re always welcome to post a new query anytime.
Thank you for being part of the Microsoft Fabric Community!

 

 

Ashish_Mathur
Super User
Super User

Hi,

In Power Query, Laboratory should be a seperate column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Chanty4u
Regular Visitor

Power BI, you cannot store both text and numbers in the same column as numeric type — a column is either text or numeric, not both.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors