Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
prashantsanchet
Creator
Creator

Ratio calculation from two table

Hi Team,

I have 2 table

Table 1 :   :Date,Country,Region,State,DailySales,MTDSales,QTDSales



Table 2: Date,Country,BudgetAmount

I want t create a on more fired which will be Margin% = (MTDsales value at selected Business Date) /  (Budget Amount of Monthstart date)

How we can calculate this in Load Script ?


If user select a for ex; 15th May 2018 then Margin % = (MTDsales value at 15th May 2018) / 9Budget Amount at 01st may 2018.)



3 Replies
YoussefBelloum
Champion
Champion

Hi,

if your Budget table is Budgeted per month, so in your chart you will need to use a Month field to be able to compare Sales Vs Budget.

If you want to do the calculation on the script, yo should Join the tables to be able to create the Margin% field.

you can also create the calculation on the chart using: sum(Sales)/sum(Budget)

prashantsanchet
Creator
Creator
Author

Hi ,

My both table are having daily level granular data.

I need to get this column for each  date

:

If user select a for ex; 15th May 2018 then formula is


Margin % = (MTDsales value at 15th May 2018) / Budget Amount at 01st may 2018)


How this can be achieve using script.

YoussefBelloum
Champion
Champion

Like what i said above, on the script you should have the sale field and the budget field on the same table, otherwise you will need to join the tables to be able to do something like this:

Table:

Load

.

Sales_field/budget field as margin%

.

From...

And use Sum(margin%) on your charts