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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ziyabikram96
Helper V
Helper V

A table of multiple values was supplied where a single value was expected.

CRM Log has Many-to-one relatioship with other tables.

Capture11.PNG

1 ACCEPTED SOLUTION

@ziyabikram96  - Right, you could replace what you have with something like this:

 

CC StartDate =
  SWITCH(TRUE(),
    MAXX(RELATEDTABLE('CRM Log'),[CS Referred To]) = "Supply Chain",LOOKUPVALUE(....),
    MAXX(RELATEDTABLE('CRM Log'),[OPS Referred To]) = "Supply Chain",LOOKUPVALUE(....),
    MAXX(RELATEDTABLE('CRM Log'),[SC Referred To]) = "Supply Chain",LOOKUPVALUE(....),
    BLANK()
  )

 

The other thing that is causing your issues are your DISTINCT statements. That returns a table of values and then you are trying to use it as a scalar. That won't work and is actually probably the source of the error you are getting.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

@ziyabikram96 - Pretty sure you can't nest SWITCH statements like that unless you are using SWITCH(TRUE()...) I would "switch" that DAX to use a single SWITCH(TRUE()...) statement, what you have there is kind of an abomination. No offense.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@ziyabikram96 , difficult to tell. check each lookup separately. it should return only one value

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I am trying to calculate a calculated column through this expression. The current table has one-to-many relationship with CRM Log.

ziyabikram96_0-1596124822629.png

 

@ziyabikram96  - Right, you could replace what you have with something like this:

 

CC StartDate =
  SWITCH(TRUE(),
    MAXX(RELATEDTABLE('CRM Log'),[CS Referred To]) = "Supply Chain",LOOKUPVALUE(....),
    MAXX(RELATEDTABLE('CRM Log'),[OPS Referred To]) = "Supply Chain",LOOKUPVALUE(....),
    MAXX(RELATEDTABLE('CRM Log'),[SC Referred To]) = "Supply Chain",LOOKUPVALUE(....),
    BLANK()
  )

 

The other thing that is causing your issues are your DISTINCT statements. That returns a table of values and then you are trying to use it as a scalar. That won't work and is actually probably the source of the error you are getting.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Terrific!! Thanks alott!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors