Forum Discussion

Danielcortes97's avatar
Danielcortes97
New Member
11 months ago
Solved

Problemas con tabla calendario

Buenas tardes, escribo en este foro porque no he logrado arreglar este problema, soy relativamente nuevo y al intentar hacer la tabla calendario me pasa algo curioso, esta es mi tabla vista desde los datos, si se puede notar Date si se toma como fecha (como en la imagen):

pero al momento de intentar convertirla en mi tabla de fechas, que se ve que esta todo ok:

 

Sucede que powerbi deja de reconocer la columna Date y la comienza a tomar como si fuera un ID y aparte al hacer la union a mi tabla de estudio le quita el dibujo calendario a la columna de la fecha de inventarios

 

esto no me ha permitido poder utilizar "SAMEPERIODLASTMONTH" debido a que no lo reconoce en realidad como si fuera una fecha sino que un ID.

 

Agradeceria su ayuda

 

  • v-menakakota's avatar
    v-menakakota
    10 months ago

    Hi Danielcortes97 ,

    Thank you for the update,this doesn’t seem to be a Power BI bug. When you mark a table as a Date table, Power BI changes the icon that’s normal and doesn’t affect the data type.

     

    To make sure SAMEPERIODLASTMONTH works, please check these points:


    The Date table is marked as a Date table using the Date column.
    The relationship between your Date table and fact table is based on that Date column.

    Your Date table has unique and continuous dates.

6 Replies

  • Hi,

    I dont know Spanish, however crome auto translator helped 🙂

    When you define a Date table, it will change the icon of the date column. If you select your Date column, you will see it is still date data type. Hence no issue with that; its not changing its data type.

    The idea of defining date table is, it would stop creating underlying date tables in other tables. also you could use the Date key (YYYYMMDD) to join your other fact tables and all Time Inteligance functions should work properly.

    So, you can join your fact table using your date key and Dax functions should work properly.

     

    Hope this helps.

    If this helps to resolve your problem, then please mark it as solution.

    Thanks - Samrat

    • Danielcortes97's avatar
      Danielcortes97
      New Member

      Hello, thanks for your response. I've decided to use the translator for better communication. Given this, I've searched for endless solutions, but none of them have resolved the issue. The ID symbol wouldn't affect me if it didn't let me use SamePeriod, which I need for a cumulative table. I do everything as directed, and when I try to transform the table, it stops recognizing it as a date. Through queries to the AI, I've found that this could be a bug in the PowerBI build in recent months. I ran the test on another computer on a blank report and the same thing happened. Could this be true?

      • v-menakakota's avatar
        v-menakakota
        Icon for Community Support rankCommunity Support

        Hi Danielcortes97 ,

        Thank you for the update,this doesn’t seem to be a Power BI bug. When you mark a table as a Date table, Power BI changes the icon that’s normal and doesn’t affect the data type.

         

        To make sure SAMEPERIODLASTMONTH works, please check these points:


        The Date table is marked as a Date table using the Date column.
        The relationship between your Date table and fact table is based on that Date column.

        Your Date table has unique and continuous dates.

  • Hi, there could be different possible causes, for example your Date column isn’t a true continuous date type, or there are non-consecutive or missing dates. 


    i'd suggest using below DAX sample code to rebuild your Date table and recreate your relationship, then mark it as Date table. This normally would be easier than trouble shooting your issues. 

     

    DateDim =
    ADDCOLUMNS (
    CALENDAR (DATE(2018,1,1), DATE(2030,12,31)), // Set your desired range
    "Year", YEAR([Date]),
    "Month Number", MONTH([Date]),
    "Month Name", FORMAT([Date], "MMMM"),
    "Month Year", FORMAT([Date], "YYYY-MMM"),
    "Quarter", "Q" & FORMAT([Date], "Q"),
    "Year-Quarter", FORMAT([Date], "YYYY") & "-Q" & FORMAT([Date], "Q"),
    "Week Number", WEEKNUM([Date], 2), // 2 = Monday-based weeks
    "Day", DAY([Date])
    )

    • v-menakakota's avatar
      v-menakakota
      Icon for Community Support rankCommunity Support

      Hi Danielcortes97 ,
      Thanks for reaching out to the Microsoft fabric community forum. 

       

      I would also take a moment to thank  MasonMA  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

      I hope the below details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you 

         

      Best Regards, 
      Community Support Team