Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following variables
If(ISNULL([P9AGSM]), 0, P9AGSM) AS P9AGSM,
If(ISNULL([P9AG]), 0, P9AG) AS P9AG,
If(ISNULL([P9REAG]), 0, P9REAG) AS P9REAG,
Which I'm trying to consolidate into the following:
[P9AG] + [P9AGSM] + [P9REAG] AS [PDAG]
When I only put P9AG and P9REAG into PDAG, it shows up in my line chart (just PDAG mapped over time). However, when I add P9AGSM to the calculation for PDAG, it just results in 0 across the chart. I'm unsure why this is happening, as I've accounted for null values in P9AGSM. I also know that P9AGSM is a populated field, because when I create a pivot table to display P9AGSM, it shows the correct values. It's only when it's added to PDAG that PDAG becomes 0. Please help me figure out why this might be happening.
How are you consolidating, hope you are doing using preceeding load, something like this -
Load *, [P9AG] + [P9AGSM] + [P9REAG] AS [PDAG]
;
Load Fields (You are doing your null check here)
From table;
On another note, you should be using Coalesce(P9AGSM,0) AS P9AGSM. I think coalesce is made for such situations.
Thanks,
When adding values together in the script then the output becomes null if any of the terms are null.
If any of the three fields are null then the PSAG will be null as well.
To get around this issue you could try to use rangesum(), it will treat all non-numeric values as 0 (zero).
Try using this expression in your script.
rangesum([P9AG] , [P9AGSM] , [P9REAG]) AS [PDAG]