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.
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
Solved! Go to 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,
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.
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 , then it should be min/max or should be grouped? No need add like a measure.
@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.
@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 )
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |