Search code examples
reporting-servicesssrs-2008ssrs-tablixcsrss

dynamic Format at ssrs


this one is my report

enter image description here This is my result (but iddescripcion is not visible)

enter image description here

my question is.

how do i get when iddescripcion=1,3,5,8 or 10 then valor is going to have this format 10,000 (not decimals) when iddescripcion=2,4,6, or 9 then valor is going to have this format 1,000.0 or 3,000.1( one decimal) and when iddescripcion=7,11 then valor is going to have this format $2,389,012 (not decimalsa and $ before) i believe the format i need add it at here but i do not have any idea how to do it.. enter image description here


Solution

  • You can apply condition formatting using a Switch or IIf statement in the Text Box Expression value.

    enter image description here

    I put a simple example together using the following expression:

    =Switch(Fields!iddescripcion.Value = 1 or Fields!iddescripcion.Value = 2, Format(Fields!valor.Value, "N0")
        , Fields!iddescripcion.Value = 3 or Fields!iddescripcion.Value = 4, Format(Fields!valor.Value, "N1")
        , Fields!iddescripcion.Value = 5 or Fields!iddescripcion.Value = 6, Format(Fields!valor.Value, "$#,#"))
    

    Basically just applying Format to valor based on iddescripcion for each row. This works for some simple data:

    enter image description here

    Hopefully you can adapt this for your example.