Forum Discussion

hcze's avatar
hcze
Helper II
2 months ago
Solved

Error cannot be pushed to the remote data source and cannot be used in this scenario

Hi, I have two tables: - Transaction table from a separate Power BI Semantic model (t_sales) - Local Date table as slicer (dim_date) I'd like to add a calc column "ActiveFlag" with folowing f...
  • pcoley's avatar
    2 months ago

     

    hcze 
    Calculated columns are static
    — They are evaluated row-by-row at model refresh/load time (in row context), not dynamically based on slicer selections (filter context). SELECTEDVALUE(dim_Date[Date]) returns a value based on the current filter context from a visual/slicer, which doesn't exist when the column is being calculated.

    Composite model limitations — Your t_sales table comes from a remote Power BI semantic model (DirectQuery), while dim_date is local (Import mode). In composite models:

    • Calculated columns on remote tables have very strict limits (mostly simple intra-row operations).
    • You cannot easily mix local and remote tables in calculated columns, especially with functions like SELECTEDVALUE

    I suggest you to switch your logic to a measure — it evaluates dynamically in the filter context of the visual/slicer.

    Active Flag = 
    VAR _SelectedDate = SELECTEDVALUE(dim_Date[Date])
    RETURN
        IF(
            ISBLANK(_SelectedDate),
            BLANK(),  // or "Unknown" / TRUE() depending on your needs
            t_sales[cancellationdate] > _SelectedDate
        )

    Use this measure in visuals (e.g., as a filter, in a table/matrix, for conditional formatting, or in other calculations).

     

    And for counting/summing active transactions you can use something like this:

    Active Transactions = 
    CALCULATE(
        COUNTROWS(t_sales),
        [Active Flag] = TRUE()
    )