Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
qliktech_uk
Contributor III
Contributor III

Set analysis - division

Hi,

If I have to calculate sum(x)/sum(y) for the latest month in a text box would I have to do it this way

sum({<[Month ] = {'$(VMaxMonth)'}>}x) /sum({<[Month ] = {'$(VMaxMonth)'}>}y)

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Normally, This?

Sum({<Month = {'$(=Max(Month))'}>} (x/y))

With Variable, This?

sum({<Month = {'$(VMaxMonth)'}>} (x/y))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

13 Replies
Kushal_Chawda

what is the Format of your month?

Anil_Babu_Samineni

Normally, This?

Sum({<Month = {'$(=Max(Month))'}>} (x/y))

With Variable, This?

sum({<Month = {'$(VMaxMonth)'}>} (x/y))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
techvarun
Specialist II
Specialist II

you can also use FirstSortedValue function. A sample data would be helpful here

its_anandrjs

Did you have num month field if not please introduce in data model

Load

*,

Num(Month(DateField)) as NumMonth

From Source;

On the UI try this

sum({<NumMonth = { "$(=Max(NumMonth)" }>}x)  / sum({<NumMonth = { "$(=Max(NumMonth))" }>}y)

qliktech_uk
Contributor III
Contributor III
Author

How do we use this function in this case

consider the following data

Month   SentFiles        ReceivedFIles

1            100                       90

2             200                     100

I want to get the month 2 data in this format 100/200.      

its_anandrjs

Another way try this also for latest month

sum({<NumMonth = { "$(=Num(Month(Today()))" }>}x)  / sum({<NumMonth = { "$(=Num(Month(Today())))" }>}y)

Kushal_Chawda

try this

sum({<[Month ] = {"$(=max(Month))"}>}x) /sum({<[Month ] = {"$(=max(Month))"}>}y)

its_anandrjs

Then try this if Month is NUM field

sum({<[Month ] = {"$(=max(Month))"}>} ReceivedFIles) / sum({<[Month ] = {"$(=max(Month))"} >} SentFiles)

techvarun
Specialist II
Specialist II

FirstSortedValue(ReceivedFIles/SentFiles,-Month)