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
SYM1986
Helper I
Helper I

how to keep two formats in one column.

KPI

Value
Turnover rate3%
NC rate1%

Transportation cost

1.73

operation cost

2.2

 

Hi all,

I have a report to finish with using power bi, the data source is silimarl like above.  The column of value contain two format, percentage and decimal,  and i want to keep both the formats for creating report.

Can anyone help me find how to keep the two formats? because now the power bi covert them into deical.

Thanks a lot

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

Hi, @SYM1986 

You can create a Measure with CONTAINSSTRING and FORMAT function. However, the data type of values in this Measure is Text. As @CNENFRNL  said, there is only one data type for one column.

 

TwoFormatsValue = IF(CONTAINSSTRING(SELECTEDVALUE('Table'[KPI]),"rate"),FORMAT(SELECTEDVALUE('Table'[Value]),"#%"),SELECTEDVALUE('Table'[Value]))

 

The result looks like this:

v-cazheng-msft_0-1610961292106.png

 

Best Regards,

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-cazheng-msft
Community Support
Community Support

Hi, @SYM1986 

You can create a Measure with CONTAINSSTRING and FORMAT function. However, the data type of values in this Measure is Text. As @CNENFRNL  said, there is only one data type for one column.

 

TwoFormatsValue = IF(CONTAINSSTRING(SELECTEDVALUE('Table'[KPI]),"rate"),FORMAT(SELECTEDVALUE('Table'[Value]),"#%"),SELECTEDVALUE('Table'[Value]))

 

The result looks like this:

v-cazheng-msft_0-1610961292106.png

 

Best Regards,

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello!! I got the same situation but i want to do a line chart of these 2 values ( Numebrs and %)

 

The % are not visable but the number we can see them. Please help! 

SalvadorOchoa_1-1701812080026.png

 

 

SalvadorOchoa_2-1701812106077.png

 

@v-cazheng-msft  thank you,  you gave a very subtle solution.

CNENFRNL
Community Champion
Community Champion

@SYM1986 , up till the latest version of PBI, only one data format can be defined for one column.

 

As to your issue, there's a workaround like this,

1. use different measure in a matrix viz, i.e. Turnover rate, NC rate, Transportation cost etc,

2. format the matrix: Format roller - Values - show on rows

voilà, the matrix changes its layout as expected.

Screenshot 2021-01-16 060317.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

PC2790
Community Champion
Community Champion

Hi,

 

I am afraid it is not possible to do in Power BI(Pivot & Query). One column should only have one type. In case we have different data types like numbers and text, it is recommended that we set column type as Text

However, I was able to find a workaround for this here.

 

See if it works for you.

 

Please provide a Kudos to this answer if you found it interesting.

If this post helps, then please consider accepting it as the solution to help the other members find it more quickly

 

@PC2790 

Thank you

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.

Top Solution Authors
Top Kudoed Authors