DB inside DB

Post Reply
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

DB inside DB

Post by Jorge Rachid »

Hi,

I am trying to use DB inside DB and I do not have any idea why is not working.

Find attached the screenshots to show the problem.

Can anybody please give me a insight of what could be wrong?

Thanks in advance,

JR
Attachments
Doubt.docx
(314.18 KiB) Downloaded 426 times
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: DB inside DB

Post by Wim Gielis »

Your mistake is probably that "Agente - AB e TO" is not the same as "Agente - AB" (see the first nested DB() ). Unless it's an alias.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

Hi Wim,

It is an alias and I also have tested both DB's and the problem is on the second.

If I use this second DB alone it works. But when it is inside another one I have a problem.

I really don't have idea of what is happening, unfortunately.
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: DB inside DB

Post by Wim Gielis »

Don't you have an issue with numbers and strings ?
Elements in a dimension are always strings, even when they look like numbers.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

I am using they like numbers but it should be string? I didn't knew this. I will fix it and try again.

Tks.
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

It doesn't work. I set the metric as string and it was impossible to do the rule because it is a string.

Then I have changed to string the numbers of the source cube and not worked either.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: DB inside DB

Post by tomok »

Dimension elements are always strings, regardless of the actual characters used in their names. If you are going to write a DB formula to pull back a value from a cube in order to substitute it for an element name in another part of a formula the value you are pulling back must always be a string.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: DB inside DB

Post by declanr »

As the guys are alluding to; you need to wrap an STR function around the DB.
Declan Rodger
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: DB inside DB

Post by tomok »

Jorge Rachid wrote:It doesn't work. I set the metric as string and it was impossible to do the rule because it is a string.

Then I have changed to string the numbers of the source cube and not worked either.
All the arguments in a DB formula must be strings. If the value pulled back from this DB:

DB('Volume', !Produtos, !Operacoes, !Itens de Faturam, !Meses Ano, 'Agente -AB')

is not a string then your rule will not work, Time to go back to the drawing board and figure out another strategy.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

But what happens in the case like mine where the element is calculated? How can I use as string if I have some calculations?
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: DB inside DB

Post by tomok »

Declanr already gave you the answer. Use the STR function to convert it to a string.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

I did but still not working.

The DB now it is like this:

['Preço - PA'] = N:
DB('Tabela Preco PA'
, DB('Volume', !Produtos, !Operacoes, !Itens de Faturamento, !Meses Ano, 'Agente - AB')
, STR(DB('Volume', !Produtos, !Operacoes, !Itens de Faturamento, !Meses Ano, 'Taxa Ocupação Ajustada'),3,2)
, '51-100'
, 'Preço');

And the cube where I get the information keep as number.

Is that correct?
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: DB inside DB

Post by Wim Gielis »

Did you right-click the calculated cell and choose "Trace calculation" ?
Seems obvious to first use the tools available to you to see what is going on.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

Yes and the only thing that I can see it is zero for this second DB.
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: DB inside DB

Post by Wim Gielis »

What about the decimal separator ?
Did you create an addition string measure in the / a cube, to only test the STR( DB( )) part ?
If that still gives you the wrong result, please hardcode parts in the formula(s) until you get it working.
After that, bring in the formulas / functions again instead of hardcoded elements.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Jorge Rachid
Posts: 113
Joined: Fri Jul 22, 2016 8:33 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2013

Re: DB inside DB

Post by Jorge Rachid »

Hi,

Now it is working.

When I use the STR function the number is not 1,95 anymore but 1.95.

So on destination cube I changed the values of dimension and now the DB works.

Sorry and thanks so much!

JR
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: DB inside DB

Post by Wim Gielis »

That's indeed what I meant with checking the decimal separator.

Glad that it's working now !
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply