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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Madhun
Frequent Visitor

Compare all the values in a row with a number, execute Measure1 if true or Measure 2 if false

Hello,

I'm trying to write a logic where i need to calculate a measure based on specific weeks as shown below. However i end up either getting one of the following errors
"A single value for column in table cannot be determined power bi" or
"The expression refers to multiple columns Multiple columns cannot be converted to scalar value"

If(
Table[FY_Year_Weeknum]<202248,
Measure1,
Measure2
)

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Madhun , You have to use selectedvalue or max

 

 

If(
selectedvalues(Table[FY_Year_Weeknum])<202248,
Measure1,
Measure2
)

 

or

 

If(
max(Table[FY_Year_Weeknum])<202248,
Measure1,
Measure2
)

View solution in original post

v-yiruan-msft
Community Support
Community Support

Hi @Madhun ,

It seems you are creating a measure,  please update the formula of your measure as below. Please find the details in the attachment.

Measure = IF ( SELECTEDVALUE ( 'Table'[FY_Year_Weeknum] ) < 202248, [Measure1], [Measure2] )

yingyinr_0-1645523104751.png

In addition, you can review the following blog to get a better understanding of why you are getting this DAX error message.

DAX error messages in Power BI

Best Regards

Community Support Team _ Rena
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

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @Madhun ,

It seems you are creating a measure,  please update the formula of your measure as below. Please find the details in the attachment.

Measure = IF ( SELECTEDVALUE ( 'Table'[FY_Year_Weeknum] ) < 202248, [Measure1], [Measure2] )

yingyinr_0-1645523104751.png

In addition, you can review the following blog to get a better understanding of why you are getting this DAX error message.

DAX error messages in Power BI

Best Regards

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

@v-yiruan-msft ,

Thank you for your response. I used the same logic and it worked for me 🙂

amitchandak
Super User
Super User

@Madhun , You have to use selectedvalue or max

 

 

If(
selectedvalues(Table[FY_Year_Weeknum])<202248,
Measure1,
Measure2
)

 

or

 

If(
max(Table[FY_Year_Weeknum])<202248,
Measure1,
Measure2
)

@amitchandak 

Thanks for the response. Selectedvalue() function did the job for me 🙂

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.