Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
gz
Contributor III
Contributor III

Dividing measures from two different tables

Hi, I have data in two tables, in both I have the same measure "Number of NIPs". I would like to divide the value of the second table by the value from the first table. How can I do this? 

gz_0-1701948739694.png

 

Labels (1)
10 Replies
Chanty4u
MVP
MVP

try this way

Sum({<TableName={'Table2'}>} [Number of NIPs]) / Sum({<TableName={'Table1'}>} [Number of NIPs])

gz
Contributor III
Contributor III
Author

where should I put this expression?

gz_0-1701952357118.png

 

aruneshgupta
Contributor III
Contributor III

I believe you might have two isolated tables in the script and renamed two different measures as 'Number of NIPs' for both in the chart. Otherwise, they would automatically be associated if not renamed.

solution-  You need to join both tables based on date then automatically you can use date as dimension and sum of first table filed (no of **NIPs**) then divide second table field (no of **NIPs**).. 

 

If you have a single table with two date fields and one measure column, it would be good to create a common calendar between the dates. Replicating the table into two fact tables and creating a common calendar table to link both facts . Subsequently, you can use the common calendar month as a dimension and include measures from both tables. Additionally, you can create a third measure for division using columns from both tables.

 

Best Regards,

Arunesh 

 

 

aruneshgupta
Contributor III
Contributor III

you can try this as well. second table field name use accordingly .. it must have some different have. 

sum(Number of NIPs)/sum{"=Case acceptance date=Date of entry of the case"}>} Number of NIPs)

gz
Contributor III
Contributor III
Author

I had to change "Number of NIPs" to "**bleep**" and there is no error, but the value is invalid.

Sum({<TableName={'Table2'}>} [**bleep**]) / Sum({<TableName={'Table1'}>} [**bleep**])

gz_0-1702026075585.png

 

gz
Contributor III
Contributor III
Author

it does not work

gz_1-1702026634845.png

 

Ahidhar
Creator III
Creator III

if the column values are same in both dimensions then try something like this

tab1:
mapping load Id1 as ID,Sales;
load * Inline
[
Id1,Sales
1,10
2,10
3,10
];
tab:
load ID,Sales,Sales/applymap('tab1',ID) as Div;
load * Inline
[
ID,Sales
1,100
2,200
3,300
];

gz
Contributor III
Contributor III
Author

in both tables I have different dimensions for the date, but both dates are in the same mmm-yyy format. The measure is the same for both tables.

Ahidhar
Creator III
Creator III

are the values for Date different in both tables