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

Question: Current and Previous year comparisons

Hi,

I have a dashboard that shows sales comparison between Current Year(selected in listbox) and Previous Year.

I calculate the previous year Sales in the charts using the logic:  sum({<[Year]={"$(=Max([Year])-1)"}>}[Sales])

The issue is that since there is no data for say April onwards for 2021, the charts show blank when April-Dec is selected in month listbox though it should show data for 2020. The months that don't have data for 2021 are greyed out in the Month listbox.

 

Attaching a screenshot to explain the issue.

 

AB108_0-1617136358642.png

 

 

Labels (2)
2 Replies
QFabian
Specialist III
Specialist III

Hi @AB108 , first all, you must remember that if there is not month April in 2021, and you clic on April, it is going to automaticaly to break the year selection, and pick the year that has values in April.

So, you can do a few test :

1.- please check wht happens modifying this :

QFabian_0-1617138398271.png

 

2.- please check wht happens modifying this :

QFabian_1-1617138660164.png

 

3.- Test  with theses  expressions :

exp1: sum({<[Year]={"$(=Max([Year]))"}>}[Sales])

exp2 : sum({<[Year]={"$(=Max([Year])-1)"}>}[Sales])

 

QFabian
AB108
Contributor III
Contributor III
Author

Hi @QFabian , Thanks for your reply.

The first two options dint work. The expression you added is exactly what I am using.

Any other way to get this to work.