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
Syndicate_Admin
Administrator
Administrator

Multi-format numbers in the same column

Dear community very good afternoon, I have the following problem:

I have a numeric type column called Value Month, what I need is for the prensentaod value in the table to have its corresponding format. That is, for example for the first row, "Cost Reduction" I need it to be displayed in Euro Currency format, for the next row I need it to be displayed with a normal number and for the third I need it to be displayed in percentage format.

I tried to do it using conditional columns, but the display in the table makes me dirty because of the number of additional columns I need to add.

alexis0730_1-1655420024167.png

Is there a functional way that allows me to give a specific format to each value depending on the unit I need?

I also have a column called unity that I can use as a conditioner.

I remain attentive to some extra data that can serve me.

Best regards.

1 ACCEPTED SOLUTION
Hariharan_R
Solution Sage
Solution Sage

Hi

Try like below.

Result =
VAR _Type =
SELECTEDVALUE ( 'Table'[Type] )
VAR _value =
SUM ( 'Table'[Value] )
RETURN
SWITCH (
TRUE (),
CONTAINSSTRING ( _Type, "$" ), FORMAT ( _value, "$ #,00" ),
CONTAINSSTRING ( _Type, "Days" ), FORMAT ( _value, "#,00" ),
CONTAINSSTRING ( _Type, "%" ), FORMAT ( _value, "#.00 %" )
)

Hariharan_R_0-1655438869048.png

Thanks

Hari

Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


My Blog :: YouTube Channel :: My Linkedin


View solution in original post

2 REPLIES 2
Hariharan_R
Solution Sage
Solution Sage

Hi

Try like below.

Result =
VAR _Type =
SELECTEDVALUE ( 'Table'[Type] )
VAR _value =
SUM ( 'Table'[Value] )
RETURN
SWITCH (
TRUE (),
CONTAINSSTRING ( _Type, "$" ), FORMAT ( _value, "$ #,00" ),
CONTAINSSTRING ( _Type, "Days" ), FORMAT ( _value, "#,00" ),
CONTAINSSTRING ( _Type, "%" ), FORMAT ( _value, "#.00 %" )
)

Hariharan_R_0-1655438869048.png

Thanks

Hari

Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


My Blog :: YouTube Channel :: My Linkedin


Anonymous
Not applicable

tried switch function in my report page did not get the result .  used new column write the following 

SWITCH(

    TRUE(),
    MLayout[name] = "Revenue", [Revenue],
    MLayout[name] = "Gros Profit", [GP],
    MLayout[name] = "Gros Margin",FORMAT([GP Margin],"#.00 %")
    )
 
error message " expression that yield variant data-type can not be used to define calculated columns"

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.