Forum Discussion

Jyaul1122's avatar
Jyaul1122
Helper III
1 year ago
Solved

Increment Refresh

Hi I have data from multiple excel on shaerpoint folder & received weekly (new file) with file name data date. Each file contents data for three table Project,Profit and Loss in sinlge sheet Sheet1 ...
  • v-dineshya's avatar
    v-dineshya
    1 year ago

    Hi Jyaul1122 ,

    The error message "Database consistency checks (DBCC) failed while checking the column statistics." indicates that Power BI’s internal tabular model (used in the dataset) encountered corruption or inconsistency during processing.

     

    Please check below things to fix the issue.

     

    1. Stabilize Schema Before Refresh, Check that all files have consistent column structures. If headers vary, use a standardized schema mapping before promoting headers.

     

    Please try below M code.

     

    let
    Source = Master,
    FilteredTable = Table.SelectRows(Source, each ([Column6] = "Profit")),
    PromotedHeaders = Table.PromoteHeaders(FilteredTable, [PromoteAllScalars=true]),
    StandardizedColumns = Table.RenameColumns(PromotedHeaders, {
    {Table.ColumnNames(PromotedHeaders){0}, "Date Increment"},
    {Table.ColumnNames(PromotedHeaders){1}, "Project"},
    {Table.ColumnNames(PromotedHeaders){2}, "Sub Project"},
    {Table.ColumnNames(PromotedHeaders){3}, "Profit"}
    }),
    ChangedTypes = Table.TransformColumnTypes(StandardizedColumns, {
    {"Date Increment", type datetime},
    {"Project", type text},
    {"Sub Project", type text},
    {"Profit", Int64.Type}
    }),
    FilteredIncrement = Table.SelectRows(ChangedTypes, each [Date Increment] >= RangeStart and [Date Increment] < RangeEnd)
    in
    FilteredIncrement


    2. Before publishing, load all files locally in Power BI Desktop and check No missing columns, No null headers and No type mismatches.

     

    3. If you have intermediate queries like Master or Transform File, disable load for them to reduce memory pressure and avoid schema conflicts.

     

    4. Sometimes, the dataset in the service gets corrupted, Delete the dataset from Power BI Service and Re-publish the report from Power BI Desktop and Reconfigure incremental refresh.

     

    5. While dynamic indexing (Table.ColumnNames(){1}) works during development, it can break in service. Prefer static column names after schema stabilization.


    6. You can create a function to normalize schema across files before combining. Please refer below M code.

     

    (TableToNormalize as table) =>
    let
    Renamed = Table.RenameColumns(TableToNormalize, {
    {Table.ColumnNames(TableToNormalize){0}, "Date Increment"},
    {Table.ColumnNames(TableToNormalize){1}, "Project"},
    {Table.ColumnNames(TableToNormalize){2}, "Sub Project"},
    {Table.ColumnNames(TableToNormalize){3}, "Profit"}
    }),
    Typed = Table.TransformColumnTypes(Renamed, {
    {"Date Increment", type datetime},
    {"Project", type text},
    {"Sub Project", type text},
    {"Profit", Int64.Type}
    })
    in
    Typed


    Note: Then apply this function to each file before combining.

     

    I hope this information helps. Please do let us know if you have any further queries.

     

    Regards,

    Dinesh