Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
android1
Post Patron
Post Patron

Error 'The expression refers to multiple columns....

Hi,

 

Does anyone know why this measure is throwing up an error 'The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

 

Sales PW =
VAR CurrentWeek =
SELECTEDVALUE ( MyDateTable[Week Number] )


VAR CurrentYear =
SELECTEDVALUE ( MyDateTable[Year] )


VAR MaxWeekNumber =
CALCULATE ( MAX ( MyDateTable[Week Number] ), ALL ( MyDateTable ) )


RETURN


SUMX (
FILTER (
ALL ( MyDateTable ),


IF (
CurrentWeek = 1,
MyDateTable[Week Number] = MaxWeekNumber
&& MyDateTable[Year]
= CurrentYear - 1,
MyDateTable
= CurrentWeek - 1
&& MyDateTable[Year] = CurrentYear
)
),
[Total Hours]
)

1 ACCEPTED SOLUTION
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @android1,

Based on my test, it seems that you have forgotten add a column name in 'MyDateTable
= CurrentWeek - 1'
You could refer to below formula and test it again:

Sales PW =
VAR CurrentWeek =
    SELECTEDVALUE ( MyDateTable[Week Number] )
VAR CurrentYear =
    SELECTEDVALUE ( MyDateTable[Year] )
VAR MaxWeekNumber =
    CALCULATE ( MAX ( MyDateTable[Week Number] ), ALL ( MyDateTable ) )
RETURN
    SUMX (
        FILTER (
            ALL ( MyDateTable ),
            IF (
                CurrentWeek = 1,
                MyDateTable[Week Number] = MaxWeekNumber
                    && MyDateTable[Year]
                    = CurrentYear - 1,
                MyDateTable[Year]
                    = CurrentWeek - 1
                    && MyDateTable[Year] = CurrentYear
            )
        ),
        [Total Hours]
    )

Hope it could help you

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @android1,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @android1,

Based on my test, it seems that you have forgotten add a column name in 'MyDateTable
= CurrentWeek - 1'
You could refer to below formula and test it again:

Sales PW =
VAR CurrentWeek =
    SELECTEDVALUE ( MyDateTable[Week Number] )
VAR CurrentYear =
    SELECTEDVALUE ( MyDateTable[Year] )
VAR MaxWeekNumber =
    CALCULATE ( MAX ( MyDateTable[Week Number] ), ALL ( MyDateTable ) )
RETURN
    SUMX (
        FILTER (
            ALL ( MyDateTable ),
            IF (
                CurrentWeek = 1,
                MyDateTable[Week Number] = MaxWeekNumber
                    && MyDateTable[Year]
                    = CurrentYear - 1,
                MyDateTable[Year]
                    = CurrentWeek - 1
                    && MyDateTable[Year] = CurrentYear
            )
        ),
        [Total Hours]
    )

Hope it could help you

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.