Forum Discussion

Soles01's avatar
Soles01
New Member
3 years ago

Function 'SAMEPERIODLASTYEAR' expects a contiguous

Hello friends, how are you, I hope very well, I bring the following problem that I think there are already many posts but I have not been able to solve it, I am creating a relationship of current sales VS previous sales (1 year), using the 'SAMEPERIODLASTYEAR' function but it returns an empty value, I use the formula "Ventas año Anterior = CALCULATE ([ventas año anterior],SAMEPERIODLASTYEAR(Dates[Date]))" and it doesn't work, I already have an exclusive table for dates made with the formula "Dates = CALENDARAUTO ()" my relationship with the sales data table is *:1, so it should work, I can't get the data, then I will place the respective images.

another data, I am acquiring the information from SQL server, with a custom script

 

I hope someone can help me, thank you very much in advance

 

 

    

 

3 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Try changing the data type in your date table to Date (and make sure the data type in the sales table is also type Date).

    Also make sure the fields in the slicer and the visual are from the Date table

    • Soles01's avatar
      Soles01
      New Member

      Hi PabloBrown

      Indeed, the fields are of type date as it should be, I don't know if it has something to do with the fact that I import the data from a database with SQL, the data in the date is not continuous, since it skips days such as non-working days or holidays

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        Have you changed the data type for the date field in the Date table? The image you posted shows the data type as Date/Time and not Date