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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mb0307
Responsive Resident
Responsive Resident

Error - multiple values was supplied where a single value

Hello,

 

I have this code which was working fine but when I refreshed the data it started to show this error:

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

 

OTIF Summary = 
   CALCULATETABLE(
        SUMMARIZE( 
    'OTIF Main'
    , 'OTIF Main'[PO Number]
    , 'OTIF Main'[PO Date]
    , 'OTIF Main'[Requested Qty UoM]
    , "Vendor", CALCULATE(DISTINCT('OTIF Main'[Vendor Number]))
    , "Created by", CALCULATE(DISTINCT('OTIF Main'[Created by]))
    , "Plant", CALCULATE(DISTINCT('OTIF Main'[Plant])) 
    )
   , FILTER('OTIF Main','OTIF Main'[Transaction Validity] = "Keep")
   , FILTER('OTIF Main', DATEDIFF(TODAY(), 'OTIF Main'[Requested Delivery Date], DAY) < -13 )
   )

 

Can't find why and which line is throwing error and how to correct it.  

 

You help is much appreciated.

Thanks

1 ACCEPTED SOLUTION

As you cannot use MAX or MIN function with text to force unicity for that columns, you can use FIRSTNONBLANK or LASTNONBLANK functions, only if the vendor name is not somenthing crucial in your report. Is a workaround we often use in Sql queries, when details are not important. 

You can check this post from community for reference https://community.powerbi.com/t5/Community-Blog/LASTNONBLANK-amp-FIRSTNONBLANK-How-To-Use-This-Two-D....

 

Is important to know that the values for each column will be first or last (depends on the function used) sorted in alphabetical order,

 

View solution in original post

8 REPLIES 8
MiraAciu
Regular Visitor

Hi, 

It seems that, at refresh, one of Vendor, Created by or Plant has at least 2 distinct

values for the same combination of the values for the rest of the columns. Start to investigate there. 

After that decide what you want to keep for those 3 columns and ask here for help if you need further assistance.

mb0307
Responsive Resident
Responsive Resident

@amitchandak 

Distinct is just returning the text - vendor, plant and creator names.  I don't want those to be the criteria of table summary. 

 

@MiraAciu can i just get first vendor, plant and creator name to complete the table.  I don't want these three fields to be the table summary criteria.

As you cannot use MAX or MIN function with text to force unicity for that columns, you can use FIRSTNONBLANK or LASTNONBLANK functions, only if the vendor name is not somenthing crucial in your report. Is a workaround we often use in Sql queries, when details are not important. 

You can check this post from community for reference https://community.powerbi.com/t5/Community-Blog/LASTNONBLANK-amp-FIRSTNONBLANK-How-To-Use-This-Two-D....

 

Is important to know that the values for each column will be first or last (depends on the function used) sorted in alphabetical order,

 

mb0307
Responsive Resident
Responsive Resident

@MiraAciu  Yes. FIRSTNONBLANK worked.  Thanks

 

@amitchandak  Thanks for looking into this.

@mb0307 , then it should be min/max or should be grouped? No need add like a measure.

 

 

amitchandak
Super User
Super User

@mb0307 , I am assuming you are creating a table. Not measure. Seems fine.

Try like

 

OTIF Summary =
SUMMARIZE( filter(
'OTIF Main' ,
'OTIF Main','OTIF Main'[Transaction Validity] = "Keep" && DATEDIFF(TODAY(), 'OTIF Main'[Requested Delivery Date], DAY) < -13 )
, 'OTIF Main'[PO Number]
, 'OTIF Main'[PO Date]
, 'OTIF Main'[Requested Qty UoM]
, "Vendor", CALCULATE(DISTINCT('OTIF Main'[Vendor Number]))
, "Created by", CALCULATE(DISTINCT('OTIF Main'[Created by]))
, "Plant", CALCULATE(DISTINCT('OTIF Main'[Plant]))
)

@amitchandak  Thanks. Yes I am creating a table but this is still showing the same error.  Please see below.  

 

Screenshot 2021-01-19 131445.jpg

@mb0307 , I think distinct is the issue. It should be countdistinct

 

OTIF Summary =
CALCULATETABLE(
SUMMARIZE(
'OTIF Main'
, 'OTIF Main'[PO Number]
, 'OTIF Main'[PO Date]
, 'OTIF Main'[Requested Qty UoM]
, "Vendor", CALCULATE(COUNTDISTINCT('OTIF Main'[Vendor Number]))
, "Created by", CALCULATE(COUNTDISTINCT('OTIF Main'[Created by]))
, "Plant", CALCULATE(COUNTDISTINCT('OTIF Main'[Plant]))
)
, FILTER('OTIF Main','OTIF Main'[Transaction Validity] = "Keep")
, FILTER('OTIF Main', DATEDIFF(TODAY(), 'OTIF Main'[Requested Delivery Date], DAY) < -13 )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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