Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Visual disappears when date (year) is selected

Hello Community, 

 

I have a combo chart showing sales revenue for 2019  and  2020.     The chart is fine when ONLY 2020 is selected in the filter panes area.    But the visual disappears with an error message when I select 2019.     This is important because I have a Salesperson slicer at the top of my page that I use to select a salesperson. 

 

I believe I undersand why, due to the dateadd - 1  part of the formula.     I was thinking I needed to add AllSelected as part of the measure, but if so, not clear where to add it.   

 

This formula refers to the line showing the variance.    

 

Sum of Shipped Price YoY% =
VAR __PREV_YEAR = CALCULATE([Sum of Shipped Price],DATEADD('Date Table'[Date], -1, YEAR))
RETURN
    DIVIDE([Sum of Shipped Price] - __PREV_YEAR, __PREV_YEAR)

There are two measures, both the same, for 2019  and   2020, for the column series.  
2020 Sum of Shipments = CALCULATE(SUM(Shipments[Shipped Price]),FILTER('Date Table','Date Table'[Year]="2020"))
 

3 Replies

  • Anonymous what error message? What you are trying to achieve? Not sure if you need to filter for year 2020 in your measure. 

     

     

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Anonymous ,

     

    Based on your description, your data includes those for 2019 and 2020. When you choose 2019, you will get an error because the data before 2019 cannot be obtained.

    You'd better describe your requirements clearly, so that we can understand your scenario more clearly.

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.