Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Sv translation
languageen
Info

Download data file for this use case and upload it in your domain.

This tutorial gives you an example how to handle formulas which contain calculations with 'null' result. Otherwise when you are counting with null values the result is always 0.

def a = (filter("L_PRODUCT in ('TV')") {M_SALES})
def b = (filter("L_PRODUCT in ('Radio')") {M_SALES})
def c = (filter("L_PRODUCT in ('PC')") {M_SALES})
if(a == null || a == Double.NaN) {
a = 0
}
if(b == null || b == Double.NaN) {
b = 0
}
if(c == null || c == Double.NaN ) {
c = 0
}
return a/(a + b + c)

 

You can observe result on the visualisations below.

Result:

Image Modified

Before:

Image Added

Sv translation
languageja
Info

この場合データファイルをダウンロードし、ドメインにアップロードしてください。

このチュートリアルでは、null結果の計算を含むフォーミュラの処理例を説明します。そうでない場合、null値で計算するときは結果は必ず0になります。

def a = (filter("L_PRODUCT in ('TV')") {M_SALES})
def b = (filter("L_PRODUCT in ('Radio')") {M_SALES})
def c = (filter("L_PRODUCT in ('PC')") {M_SALES})
if(a == null || a == Double.NaN) {
a = 0
}
if(b == null || b == Double.NaN) {
b = 0
}
if(c == null || c == Double.NaN ) {
c = 0
}
return a/(a + b + c)

 

以下のビジュアルで結果を見ることができます。

結果:

Image Added

以前:

Image Modified