Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
keliane
Contributor III
Contributor III

Comparing [Net Income] of TWO differents period on the same graph

Hi all, 

Hope everything is doing good for you.

Let me introduce my problem :

I would like to compare [variable] (Net Income/Exposure/Lost...) of the SAME client during two different period of time, on the same graph. In other terms, I would like my two lines to "overlap" in my graph charts.

I tried to figure it out for some days, and I think I need to create a "Calculated Dimension" but didn't succeed. 

If possible, would like to not touch the data load editor.

That's it. 

Let me give you a clear example, so we are sure that we talk about the same thing :

P1 = DD-MM-YYYY

P2 = DD-MM-YYYY

P3 = DD-MM-YYYY

P4 = DD-MM-YYYY

 

P1P2 and P3P4 should be the same length.

 

I would like my graph to display P1P2 and P3P4 as two different line, starting from the full left of the y axis. 

I would like too to add a button, so the graph can display in base 100 too.



I know it's long. I'm still learning QlikSense so I'm sorry if this is non sense for you haha. Don't hesitate if you've questions !

 

Have a great, and thank you in advance !

Keliane

 

 

Labels (1)
1 Solution

Accepted Solutions
keliane
Contributor III
Contributor III
Author

Hi all, 

I worked a few months on this project and saw a like on the topic this night haha.

So here's the code I used : 

 

Net Income P1 (As vSelectedMonthx = YYYY-MMM) :

Num(sum({<[Date.autoCalendar.Date]={">=$(=Date(Date#(vSelectedMonth1, 'YYYY-MM')))<=$(=Date(MonthEnd(Date#(vSelectedMonth2, 'YYYY-MM'))))"} >} [Net Income]),'#,##0')

Net Income P2 : 

Num(sum({<[Date.autoCalendar.Date]={">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM')))<=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"} >} [Net Income]),'#,##0')

 

Variance : 

 

If(
    vShowPercentage = 1,
    // Percentage variance with formatting
    Num(
        (
        
        sum({<[Date.autoCalendar.Date] = {">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"} >} [Net Income])
-
sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth1, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth2, 'YYYY-MM'))))"
            } >
         
    } [Net Income]))
/
FABS( 
    sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"
            } >
         
    } [Net Income]))*-1
,'#,##0.00%'),
 
    // Nominal variance with formatting
    
    
      Num(  (
sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"
            } >
         
    } [Net Income])
-
sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth1, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth2, 'YYYY-MM'))))"
            } >
         
    } [Net Income]))/-1
 
   , '#,##0') )
 
 
 
I incorporate a variable 'vShowPercentage' link to a button, when it's pressed, the variance is showed in percentage.
 
Have a good day !

View solution in original post

2 Replies
keliane
Contributor III
Contributor III
Author

Hi all, 

I worked a few months on this project and saw a like on the topic this night haha.

So here's the code I used : 

 

Net Income P1 (As vSelectedMonthx = YYYY-MMM) :

Num(sum({<[Date.autoCalendar.Date]={">=$(=Date(Date#(vSelectedMonth1, 'YYYY-MM')))<=$(=Date(MonthEnd(Date#(vSelectedMonth2, 'YYYY-MM'))))"} >} [Net Income]),'#,##0')

Net Income P2 : 

Num(sum({<[Date.autoCalendar.Date]={">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM')))<=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"} >} [Net Income]),'#,##0')

 

Variance : 

 

If(
    vShowPercentage = 1,
    // Percentage variance with formatting
    Num(
        (
        
        sum({<[Date.autoCalendar.Date] = {">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"} >} [Net Income])
-
sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth1, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth2, 'YYYY-MM'))))"
            } >
         
    } [Net Income]))
/
FABS( 
    sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"
            } >
         
    } [Net Income]))*-1
,'#,##0.00%'),
 
    // Nominal variance with formatting
    
    
      Num(  (
sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth3, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth4, 'YYYY-MM'))))"
            } >
         
    } [Net Income])
-
sum({
        < 
            [Date.autoCalendar.Date] = {
                ">=$(=Date(Date#(vSelectedMonth1, 'YYYY-MM'))) <=$(=Date(MonthEnd(Date#(vSelectedMonth2, 'YYYY-MM'))))"
            } >
         
    } [Net Income]))/-1
 
   , '#,##0') )
 
 
 
I incorporate a variable 'vShowPercentage' link to a button, when it's pressed, the variance is showed in percentage.
 
Have a good day !
Dana_Baldwin
Support
Support

Hi @keliane 

Please note the forum you have posted to is for the Data Integration product Enterprise Manager, used for managing multiple Replicate/Compose/Catalog servers. To reach your target audience, please consider posting your question here: https://community.qlik.com/t5/Qlik-Sense/ct-p/qlik-sense

Thanks,

Dana