Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Definitions Sales Difference and Sales Variance

Can someone help me with these definitions? In the table, he gives a Sales Difference of 0 and a Sales Variance from 100%.

What do I do wrong in the definitions?

Sales Difference:

([Sales
$(vMaxYear)]
- [Sales
$(vPriorYear)]
)

Sales Variance:

If([Sales
$(vPriorYear)]
= 0,1,([Sales
$(vMaxYear)]
- [Sales
$(vPriorYear)]
) / fabs([Sales
$(vPriorYear)]
))
//If statement needed for situation vPriorYear = 0
//fabs statement needed for situation vPriorYear = negative

Thanks in advance!

Mirjam

1 Solution

Accepted Solutions
Not applicable
Author

Right formula:

 

Sales Variance:

 

If ([Sales
Difference]
= 0,0,(If([Sales
$(vPriorYear)]
= 0,1,([Sales
$(vMaxYear)]
- [Sales
$(vPriorYear)]
) / fabs([Sales
$(vPriorYear)]
))))

//If statement nodig voor situatie Sales Difference = 0
//If statement nodig voor situatie Sales vPriorYear = 0
//fabs statement nodig voor situatie Sales vPriorYear = negatief

View solution in original post

3 Replies
Gysbert_Wassenaar

You simply set the variance to 1 if the Sales of the prior year is 0:

If([Sales
$(vPriorYear)]
= 0,1

1 is 100%. You don't check if Sales of max year has a value of zero or not.


talk is cheap, supply exceeds demand
Not applicable
Author

This formula is not correct, he doesn't calculate the formula this way:

,([Sales
$(vMaxYear)]
- [Sales
$(vPriorYear)]
) / fabs([Sales
$(vPriorYear)]
)

Not applicable
Author

Right formula:

 

Sales Variance:

 

If ([Sales
Difference]
= 0,0,(If([Sales
$(vPriorYear)]
= 0,1,([Sales
$(vMaxYear)]
- [Sales
$(vPriorYear)]
) / fabs([Sales
$(vPriorYear)]
))))

//If statement nodig voor situatie Sales Difference = 0
//If statement nodig voor situatie Sales vPriorYear = 0
//fabs statement nodig voor situatie Sales vPriorYear = negatief