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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors