Conditional Formatting in Expression

rated by 0 users
Answered (Verified) This post has 1 verified answer | 6 Replies | 3 Followers

Not Ranked
Points 76
mthompson posted on Fri, Jul 30 2010 4:31 PM

Hi All....

I have a scorecard straight table where MetricId is my dimension.   I want to format an expression as integer, percent or currency depending on the metricid.   Here is a simplified test case I've been working with:

= if(MetricId=2, num(count(CRMRecType),'###,###,##0'),

       If(MetricId=5,num(count(CRMRecType)/100,'#,##0.00%'),

           If(MetricId=22,num(sum(OpportunityAmount),'$##,###,###'))))

Number format for this expression is set to "Expression Default".

My calculations are working correctly but the formatting is being ignored.  Any one of these format statements by itself works correctly but when I put them together the formatting is ignored.  What am I missing?

Thanks for any insight into this issue....

Martha 

Answered (Verified) Verified Answer

Top 100 Contributor
Points 833
Verified by mthompson

Martha

I suspect the if statement evaluates the expression and returns the evaluated value as a number, so the formatting is applied before and not after the if expression.

As a work around, you could try wrapping the num() statements with a text() statement. Then it is a text expression being evaluated.

I haven't tested this, so I can't be sure it will work. Give it a try and let us know.

Jonathan

  • | Post Points: 7

All Replies

Top 500 Contributor
Points 301

How about using the money() function rather than num()?

  • | Post Points: 7
Not Ranked
Points 76

Doesn't change the outcome -- still no formatting. 

  • | Post Points: 7
Top 10 Contributor
Points 13,337

Looks right to me.  Is the format being overridden on the Number tab?  I'm guessing not, since you say each one works individually.

  • | Post Points: 7
Not Ranked
Points 76

I selected "expression default" on the number tab.

  • | Post Points: 1
Top 100 Contributor
Points 833
Verified by mthompson

Martha

I suspect the if statement evaluates the expression and returns the evaluated value as a number, so the formatting is applied before and not after the if expression.

As a work around, you could try wrapping the num() statements with a text() statement. Then it is a text expression being evaluated.

I haven't tested this, so I can't be sure it will work. Give it a try and let us know.

Jonathan

  • | Post Points: 7
Not Ranked
Points 76

Jonathan,

Wow, you figured it out.  I added the text statement and it works!    Thank you so much.  

Martha

if

 

 

 

 

 (MetricId=2,text(num(count(CRMRecType),'###,###,##0')),

  • | Post Points: 1
Page 1 of 1 (7 items) | RSS
Share
Feedback Form