Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive warning: Column references should always be fully qualified #1008

Open
GMedlin opened this issue Oct 10, 2023 · 1 comment
Open
Labels
template: issue Issue report created by user, needs to be triaged

Comments

@GMedlin
Copy link

GMedlin commented Oct 10, 2023

Describe the issue
I'm receiving the following Tabular Editor Semantic Analysis warning message on several measures that reference a column that was added to a variable using ADDCOLUMNS & SUMMARIZE: Column reference should always be fully qualified.

This only occurs when the table expression I'm referencing uses UNION to append more than one variable's table expressions together and when one of them does not use ADDCOLUMNS. I would expect TE's syntax checker to be aware that if I UNION any table expression where I'm creating my own column with ADDCOLUMNS, then physical table reference is not needed for that column. Currently, it appears to be checking the first table expression in the UNION because the warning disappears if the first table in the UNION is the one using ADDCOLUMNS.

** Which version are you currently using? **
Tabular Editor 3, version: 3.11.0.26496
Tabular Editor 3 edition: Enterprise

To Reproduce
Connect to Power BI dataset.

Create a measure similar to the one below. Confirm a warning message is displayed on line 38: [cfAmtActual], Column references should always be fully qualified. Notice that the warning goes away if you change the order of the table expression variables in the VAR _XIRRTable UNION.

VAR _MaxAsOfDate = MAX ( DimAsOfDate[asOfDateCode] )
VAR _PreviousAsOfDate = EOMONTH(_MaxAsOfDate, -15)
VAR _PriorCarryingValue =
    CALCULATETABLE (
        ADDCOLUMNS(
            SUMMARIZE (
                FactCashflows, 
                FactCashflows[dateCode],
                FactCashflows[dealCode]),
                "cfAmtActual", CALCULATE(SUM(FactCashflows[carryingValue])) * -1           
        ),
        DimCashFlowType[Cashflow Category] = "CV",
        DimDate[Date] = _PreviousAsOfDate
    )
VAR _CurrentCashFlowValues =
    CALCULATETABLE (
        SUMMARIZE (
            FactCashflows,
            FactCashflows[dateCode],
            FactCashflows[dealCode],
            FactCashflows[cfAmtActual]
        ),
        DimCashFlowType[Cashflow Category] IN {"Investments", "Realizations", "CV"},
        FILTER (
            ALL ( DimDate ),
            DimDate[Date] > _PreviousAsOfDate
                && DimDate[Date] <= _MaxAsOfDate
        )
    )
VAR _XIRRTable =
    UNION (
        _PriorCarryingValue,
        _CurrentCashFlowValues    
    )
VAR  _XIRR = 
    XIRR(
        _PriorCarryingValue,
        [cfAmtActual],
        FactCashflows[dateCode]
    )
RETURN
    _XIRR

Expected behavior
I would expect no warning.

Screenshots
Warning
image
No Warning
image

Desktop (please complete the following information):

  • Windows version: 11
@otykier
Copy link
Collaborator

otykier commented Oct 11, 2023

Hmm, this is an interesting case. I tend to agree with you, but I would like to ask @marcosqlbi's opinion also.

The documentation for UNION says:

The returned table has lineage where possible. For example, if the first column of each Table has lineage to the same base column C1 in the model, the first column in the UNION result will have lineage to C1. However, if combined columns have lineage to different base columns, or if there is an extension column, the resulting column in UNION will have no lineage.

So in your case, the resulting expression should not have lineage to any base column, and therefore, we should not warn about a missing column reference regardless of the order of tables in UNION. For sure, if the has used a table prefix in the extension column, or if the output from UNION preserves lineage, then it makes sense to show the warning, in my opinion. But I don't think that applies in this case.

@otykier otykier added the template: issue Issue report created by user, needs to be triaged label Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: issue Issue report created by user, needs to be triaged
Development

No branches or pull requests

2 participants