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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Rohini
Helper I
Helper I

Custom Format each row based on column

I have data in the below format with the columns 'Metric', 'Actual Value' and 'Metric Format'. Based on the column 'Metric Format', I would like to populate the column 'Desired Outcome' in the visual (matrix) in the output.

Input:

MetricActual ValueMetric Format
A0.880%
B2497#,##0
C435$#,##0

 

Output:

MetricDesired Outcome
A88%
B2,497
C$435

An ex-employee was able to do this and I am trying to figure out where the settings need to change. Would appreciate if anyone can help.

 

1 ACCEPTED SOLUTION
Rohini
Helper I
Helper I

The below code worked:

 

Desired Outcome = if( Not(ISERROR(value('TableName'[Actual Value]))), format(value('TableName'[Actual Value]),'TableName'[Metric Format]),'TableName'[Actual Value])

View solution in original post

2 REPLIES 2
Rohini
Helper I
Helper I

The below code worked:

 

Desired Outcome = if( Not(ISERROR(value('TableName'[Actual Value]))), format(value('TableName'[Actual Value]),'TableName'[Metric Format]),'TableName'[Actual Value])

goncalogeraldes
Super User
Super User

Hello there @Rohini ! Check if this works for you:

Desired Outcome =
VAR _current_row =
    SELECTEDVALUE ( 'Your Table'[Actual Value] )
RETURN
    SWITCH (
        _current_row,
        "0%", FORMAT ( _current_row, "Percent" ),
        "#,##0", FORMAT ( _current_row, "#,0" ),
        "#,##0", FORMAT ( _current_row, "$#,0" )
    )

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.