Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Cross-filtering failure on SAMEPERIODLASTYEAR

Hi,

 

I have to display current year sales and compare it to last year sales. I created three measures in order to do it:

 

SalesTotal = SUM( Orders[Sales] )
SalesYTD = TOTALYTD( [SalesTotal] ; 'Date'[Date] )
SalesYTDLastYear = CALCULATE( [SalesYTD]; SAMEPERIODLASTYEAR( 'Date'[Date] ) )
 
It works fine!
But when I try to filter by Technology (or else) in the bubble chart, I have got this result:
 
I tried measures separately and it appears that it is SalesYTDLastYear which fail.
Do you know why it reacts like this?
Thanks
  • Hi,

    My guess is that for Technology, the % in the card visual evaluates to an error.  What is the measure for %?  Also, what error do you get when you click on Voir Les Details?  Share the link from where i can download your PBI file.

3 Replies

  • Hi,

    My guess is that for Technology, the % in the card visual evaluates to an error.  What is the measure for %?  Also, what error do you get when you click on Voir Les Details?  Share the link from where i can download your PBI file.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks, I did not even think of reading the error message:

      MdxScript(Model) (18, 60) Calculation error in the measurement'Orders'[ProfitYTDLastYear] : The "SAMEPERIODLASTYEAR" function expects a contiguous selection when the date column comes from a table on side 1 of a bidirectional relationship.

       

      After reading this, I changed the relationship between my tables 'date' and 'orders' as single.

      I will search for documentation about "cross-filter direction" (here I found something).