Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate quotient over month dimension?

I need to calculate expression.It's shows like quotient:

onefield/secondfield

I need to calculate it in YearToDate type.

Dividend increase separately than divider.But i need to get a sum of mounthly quotient in yeartodate type.How can i get it?

i try to use this formula:

Sum({<Date={'$(<=vMaxDate)'}>}Aggr($(vQuotient),[Nomenclatura]))

NomenclaturaQuotient
type1350


1 Solution

Accepted Solutions
Carlos_Reyes
Partner - Specialist
Partner - Specialist

Haha, it was a little error, the sum was lacking the MonthYear=. Just add it to the first expression, like this:

Sum( {<Date={"<=$(vMaxDate)"}, Month=,MonthYear=>}

    Aggr(

        Sum( {<Date={"<=$(vMaxDate)"}, Month=,MonthYear=>} OneField)

        /

        Sum( {<Date={"<=$(vMaxDate)"}, Month=,MonthYear=>} SecondField)

    ,MonthYear)

)

View solution in original post

11 Replies
Carlos_Reyes
Partner - Specialist
Partner - Specialist

I think this will do what you want, just make sure to select only one Year, so that dates from previous years are not taken into account:

Sum({<Date={"<=$(vMaxDate)"}>} OneField)

/

Sum({<Date={"<=$(vMaxDate)"}>} SecondField)

Not applicable
Author

My english so bad((

I mean that count separatly exactly a problem.Let me explain on example%

I have in January this situation

OneField=15

SecondField=5

January quotient will be 3

On February another situation

OneField=20

SecondField=10

February quotient will be 2

If we will take YearToDate separatly,we will have

OneField 35

SecondField=15

and YearToDate quotient will be 2,3

but in my case it must be 5,that is quotient on January + quotient on February

Carlos_Reyes
Partner - Specialist
Partner - Specialist

Ok, then I think should work, just create a Field called MonthYear with the MonthName function based on the Date field.

Sum( {<Date={"<=$(vMaxDate)"}>}

Aggr(

Sum( {<Date={"<=$(vMaxDate)"}>} OneField)

/

Sum( {<Date={"<=$(vMaxDate)"}>} SecondField)

,MonthYear)

)


Let me know your results.

Not applicable
Author

it doesn't work,result only for selected month((

Carlos_Reyes
Partner - Specialist
Partner - Specialist

Disregard the month selections. Try:

Sum( {<Date={"<=$(vMaxDate)"}, Month=>}

Aggr(

Sum( {<Date={"<=$(vMaxDate)"}, Month=>} OneField)

/

Sum( {<Date={"<=$(vMaxDate)"}, Month=>} SecondField)

,MonthYear)

)



Not applicable
Author

if place "Month=" in dividend and divider it will show total sum.
not work for me

(try with month= in all case,only in aggr case and only in quotient case) that not working....

Carlos_Reyes
Partner - Specialist
Partner - Specialist

Review the attached... I think that's what you want, isn't it?

Not applicable
Author

that meaning,but not that vision...i need this in YTD form....
maybe becouse of this it isn't working

example

without YTD quotient looks like

January 5

Febrary 3

March 4

April 6

But i try this

January 5

Febrary 8

March 12

April 18

And this in one field,thats changes depend on your selection

P.S. thx for helping)

Carlos_Reyes
Partner - Specialist
Partner - Specialist

Ooooooh! so you want the accumulated value. Review the attached.