0

I need to sum a value based on a condition on BI Publisher on RTF format. This is what's intended: IF FIELD1 = 'THIS' THEN SUM(FIELD2)

So far, i have the current formula:

if FIELD = 'THIS' THEN 'N/A? else sum(FIELD2) end if

The problem is that the sum is not working. It returns 0 for every result when it should be other values. THe N/A part is ok.

How can i achieve this?

Luska
  • 1
  • 1

2 Answers2

0

You could try either choose or if like here:

<xsl:choose>
    <xsl:when test="your_test_node > 20">
        <td>
            <xsl:value-of select="sum(your_node)"/>
        </td>
    </xsl:when>
    <xsl:otherwise>
        <td>
            <xsl:value-of select="sum(your_other_node)"/>
        </td>
    </xsl:otherwise>
</xsl:choose>



<xsl:if test="your_test_node &gt; 20">
    <td>
        <xsl:value-of select="sum(your_node)"/>
    </td>
</xsl:if>
d r
  • 3,848
  • 2
  • 4
  • 15
0

If you only wanna sum after checking one condition then that's what I would do in RTF template:

<?if:condition='this'?> <?sum(variable)?> <?end if?> 

or you could use if else like this:

<?xdofx:if condition='this' then sum(this) else result2 end if?>