Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qvhjenvo
Contributor
Contributor

Create a dimension based on if statement

Hi,

I want to create a dimension in a fact table

   

Customer NumberCY SalesPY Sales
1100020000
21000000100000
320000
43000000

What I want is to make the new dimension (CustNo_noSales) that shows customer who have [PY Sales] = 0

   

Customer NumberCustNo_noSalesCY SalesPY Sales
1null100020000
2null1000000100000
3320000
443000000

LOAD [Customer Number],

     [CY Sales],

     [PY Sales]

     aggr(if(sum({<[PY Sales]={0}>}[PY Sales]), CustNo_noSales),CustNo_noSales)

FROM

(ooxml, embedded labels, table is Ark1);

aggr(if(sum({<[PY Sales]={0}>}[PY Sales]), CustNo_noSales),CustNo_noSales)

This statement does not work.

I need help!

Regards

Loi

1 Solution

Accepted Solutions
sunny_talwar

Try this:

LOAD [Customer Number],

     [CY Sales],

     [PY Sales],

   If([PY Sales] = 0, [Customer Number]) as CustNo_noSales

FROM

(ooxml, embedded labels, table is Ark1);

View solution in original post

4 Replies
sunny_talwar

Try this:

LOAD [Customer Number],

     [CY Sales],

     [PY Sales],

   If([PY Sales] = 0, [Customer Number]) as CustNo_noSales

FROM

(ooxml, embedded labels, table is Ark1);

maxgro
MVP
MVP

Also in the chart with a calculated dimension

=if(([PY Sales])=0, [Customer Number])

1.png

qvhjenvo
Contributor
Contributor
Author

Thanks, Sunny.

It works.

jagan
Luminary Alumni
Luminary Alumni

Try like this

LOAD [Customer Number],

     [CY Sales],

     [PY Sales]

    if(sum([PY Sales]) = 0, [Customer Number]) AS CustNo_noSales)

FROM

(ooxml, embedded labels, table is Ark1)

Group By [Customer Number];

Hope this helps you.

Regards,

jagan.