Forum Discussion

Div's avatar
Div
Frequent Visitor
7 years ago
Solved

How to create a table which lists the count for each refresh date?

I have connected a SQL database which gets refreshed every month.  I need a table which lists the count for each month. Can someone help me with this please?
  • v-yulgu-msft's avatar
    7 years ago

    Hi Div,

     

    How does your SQL table refresh? Will the new data cover the old one? In other words, the table always shows data for only one month which is the latest one.

     

    If that is the case, what you want looks like an incremental load feature so that all history data can be stored, however this is not supported by Power BI now. Here is an idea where PG said this feature will be released in the future. As a workaround, you could export each month's data from SQL database to an Excel file, place these monthly excel files in the same folder. Then, in Power BI desktop you can get data via "Folder" connector.

     

    While if the new updated data won't cover the older one, the new month's data is just appended to the original table, you just need to import data from SQL database and refresh it every month. To get the count value per month in a summary table, please create a calculated table with this similar DAX: (suppose there existing a date field in source table)

    New Table =
    SUMMARIZE (
        DataTable,
        DataTable[DateColumn].[Year],
        DataTable[DateColumn].[Month],
        "CountValue"COUNT ( DataTable[ValueColumn] )
    )
     
    Best regards,
    Yuliana Gu