Forum Discussion

mb0307's avatar
mb0307
Responsive Resident
5 years ago
Solved

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

8 Replies

  • 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]))
    )

    • mb0307's avatar
      mb0307
      Responsive Resident

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

       

      • amitchandak's avatar
        amitchandak
        Super User

        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 )
        )

  • MiraAciu's avatar
    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's avatar
      mb0307
      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.

      • amitchandak's avatar
        amitchandak
        Super User

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