Quantcast
Channel: SQL Server Reporting Services, Power View Forum
Viewing all articles
Browse latest Browse all 4035

Why is the Expression failing?

$
0
0

I have a report with a text box that I wish to conditionally populate with either the difference between two numeric fields or fill with "N/A".  The field "dataType" contains the data type, and if "int"or "decimal" the ChangedFrom and ChangedTo fields contain valid numeric values.  At runtime the "int" and "decimal" calculations indeed work and the text box is populated correctly.  But all other values, like "date" and "varchar" result in #Error being returned.  This should be easy . . . Any suggestions?  

Thanks

=Switch(Fields!dataType.Value = "int", Fields!ChangedTo.Value - Fields!ChangedFrom.Value,

             Fields!dataType.Value = "decimal", Fields!ChangedTo.Value - Fields!ChangedFrom.Value,

             Fields!dataType.Value = "date",  "N/A",

             Fields!dataType.Value  = "varchar", "N/A" )


Viewing all articles
Browse latest Browse all 4035

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>