代码之家  ›  专栏  ›  技术社区  ›  RoverRoll

计算SSRS中条件格式表达式的百分比

  •  0
  • RoverRoll  · 技术社区  · 7 年前

    我有个条件

    **If charges of any week is zero then that cell has to be highlighted in red
    
    o If  charges of any week is 80% to 90% of total average then cell has to be highlighted in
    lime
    
    o If  charges of any week is less than 79% of total average then it cell has to be highlighted
    in light orange**
    

    我尝试了以下条件:

    IIF((SUM(Fields!ChargeAmount.Value)<>0),"Red","White",iif(sum(Fields!ChargeAmount.Value>=80% and sum(Fields!ChargeAmount.Value<=90% ,Fields!ChargeAmount.Value,"")
    

    有人能帮我吗。

    2 回复  |  直到 7 年前
        1
  •  1
  •   Wolfgang Kais    7 年前

    假设您的数据集名为“WeeklyCharges”,用于按周分组的字段名为“FirstOfWeek”,请尝试以下操作:

    在组的属性(FirstOfWeek)中,定义一个变量 FractionOfTotalAverage 使用表达式

    =Sum(Fields!ChargeAmount.Value)
      / (Sum(Fields!ChargeAmount.Value, "WeeklyCharges")
        / CountDistinct(Fields!FirstOfWeek.Value, "WeeklyCharges"))
    

    背景颜色

    =Switch(
      Variables!FractionOfTotalAverage.Value < 0.5, "Red",
      Variables!FractionOfTotalAverage.Value < 0.8, "Yellow",
      Variables!FractionOfTotalAverage.Value < 0.9, "Lime")
    
        2
  •  1
  •   Stanislovas KalaÅ¡nikovas    7 年前

    IIF((SUM(Fields!ChargeAmount.Value) = 0), "Red",
        IIF(SUM(Fields!ChargeAmount.Value) >= 80 and SUM(Fields!ChargeAmount.Value) <= 90, "Lime", "Orange")))
    
    推荐文章