If you are unable to create a new account, please email support@bspsoftware.com

 

subtract a value that exist in Query 1 from a value that is in Query2.

Started by HelloCognos, 29 Aug 2018 12:30:23 PM

Previous topic - Next topic

HelloCognos

Hi,
Quick question? :o :o

I have to subtract a value that exist in Query 1 from a value that is in Query2. I'm trying to identify the best method to
approach.

dollar gained: 300 in(Query1)
dollar lost: 200 in(Query2)


Result (Query 1.dollar_gained - Query 2.dollar_lost) :)

Do I need to join the two queries for this practice. Unfortunately, the Query 1 and Query 2 has different # of columns.

Please help if you can.

Thanks a lot!

HelloCognos


cognostechie

Yes, it needs to be joined. In some cases, two queries can be unioned too.

HelloCognos

well,
unfortunately, there is no way to join since the calculation between these two queries are based on two different reasons? But at the end, I have to subtract the results from the two queries from each other. Sorry for the confusion. So, I think I may have to create a new data item and generate a new number on each Query andthen Join them together.

Just great!!!! :o :o

cognostechie

You should probably try to understand the available data items in your package before starting the reporting process. It's possible that your package has data items for setting up the relationship and you are not just aware of it.

MFGF

Quote from: HelloCognos on 29 Aug 2018 02:00:33 PM
well,
unfortunately, there is no way to join since the calculation between these two queries are based on two different reasons? But at the end, I have to subtract the results from the two queries from each other. Sorry for the confusion. So, I think I may have to create a new data item and generate a new number on each Query andthen Join them together.

Just great!!!! :o :o

Hi,

You haven't specified if each query returns multiple rows or just one row. If each query returns multiple rows, you're going to need a common value you can use to link a row from the first query to a row from the second query - otherwise it wouldn't make any sense? However, things are different if each query returns one row. In that case, you can enable the "Cross product allowed" property for each query, and CA will join ever row in the first query to every row in the second. This only makes sense for a single row, though.

Cheers!

MF.
Meep!

HelloCognos

Thank you for your time :). I have learned about the package and possibly single row returning approach will help.

Francis aka khayman

another approach for single row is to create a data item and give a fix value for both queries. then use that for your join

HelloCognos