Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Logic Help Ratio

Hi Guys,

i Have data in attached excel like below format

  

From DateToDateRatio
01.01.201610.01.20160.1
11.01.201615.01.20160.2
16.01.201631.01.2016

0.3

You can see in this, From Data and To Date, with in some  date range Ratio is different.

i have txn Data in which i have continuous date with their sales , now let say i have 1 month total sales,

now what i want is as per the given From and To Range the sale will come in given ratio.

e.g.

let say from 01.01.2016 to 10.01.2016, the total sale is 100 than output should come like .1 % of 100.

From 11.01.2016 to 15.01.2016, the total sale shud be 0.2 % of that range sale , say 50

Attaching  excel pls have a look for sample data.

Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this?

Capture.PNG

Script:

Table:

LOAD Date#([From Date], 'DD.MM.YYYY') as FromDate,

    Date#(ToDate, 'DD.MM.YYYY') as ToDate,

    Ratio

FROM

[Ratio Test.xlsx]

(ooxml, embedded labels, table is Sheet1);

Table2:

LOAD Date,

    Value

FROM

[Ratio Test.xlsx]

(ooxml, embedded labels, table is Sheet2);

IntervalMatch:

IntervalMatch(Date)

LOAD FromDate,

  ToDate

Resident Table;

Data Model:

Capture.PNG

View solution in original post

2 Replies
sunny_talwar

To do this you need to use interval match: IntervalMatch

sunny_talwar

May be this?

Capture.PNG

Script:

Table:

LOAD Date#([From Date], 'DD.MM.YYYY') as FromDate,

    Date#(ToDate, 'DD.MM.YYYY') as ToDate,

    Ratio

FROM

[Ratio Test.xlsx]

(ooxml, embedded labels, table is Sheet1);

Table2:

LOAD Date,

    Value

FROM

[Ratio Test.xlsx]

(ooxml, embedded labels, table is Sheet2);

IntervalMatch:

IntervalMatch(Date)

LOAD FromDate,

  ToDate

Resident Table;

Data Model:

Capture.PNG