Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qliklearner11
Contributor
Contributor

If expression showing sum in proportion to current periods

 

edited. 

Labels (2)
5 Replies
sunny_talwar

Can you explain this more with an example?

qliklearner11
Contributor
Contributor
Author

edited.

sunny_talwar


@qliklearner11 wrote:

 

If the actual year (2019) contains 1 month (since we are in January), then show me the sum of sales for 1 month of the last year (2018). Otherwise show me the total sum of sales for 2018 (in the case that 2019 is over).


Which one month of 2018? Dec or Jan? or any random month?

And when you say show total? what exactly do you have as dimension here? Month or what? and that is why asked for an example (some raw data and the expected output from it).

qliklearner11
Contributor
Contributor
Author

 

edited. 

timpoismans
Specialist
Specialist

If you are working with a Calendar in your app, I'd suggest using a flag for CYTD (Current Year To Date) and LYTD (Last Year To Date). This can be achieved with yeartodate or inyeartodate.

This would make your set analysis a whole lot easier as well.