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
Anonymous
Not applicable

VALUES and table of multiple values error

Hi,

 

I want to count the discount number of months a customer is invoiced during a year. I have earlier used the VALUES-function which word fine, but now I get the error “A table of multiple values was supplied where a single value was expected”and I dont know why.

 

Here is example data:

Invoice dateCustomer
201703A
201704B
201703A
201704B
201704

A

I want to acheive this:

 

CustomerDistinct count of invoice date
A2
B1

 

Before I have successfully created the calcalated column or metric as:

'=VALUES(TableX[Invoice date])

 

But now it does not work, and I get the error message...

 

/H

1 ACCEPTED SOLUTION
Anonymous
Not applicable

With Customers on rows, the following should work (as a measure, not a calculated column)

Dist Customer Count:=DISTINCTCOUNT('Tablex [Invoice date] )

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

With Customers on rows, the following should work (as a measure, not a calculated column)

Dist Customer Count:=DISTINCTCOUNT('Tablex [Invoice date] )
Anonymous
Not applicable

Hi agian,

As the next step I would like to use the measure I created for calculating the distinct count and get the average monthly volume:

 

Raw data column

Raw data column

Raw data column

Invoice date

Customer

Volume

201703

A

10

201704

B

20

201703

A

20

201704

B

30

201704

A

40

 

 

 

Measure

NEW Calculated column or Measure

Customer

Dist. Count number of invoiced months

Average monthly volume

A

2

35

B

1

50

 

I want need this calculation= Volume (raw date column) / Dist Count number of invoiced months (measure).

 

When I write this forumla it does not work, I get the error that a single value could not be determined, and it asks for an aggregations such as min, max etc.

 

Maybe its also not possible to use a measure in a measure?

Anonymous
Not applicable

It is. When using a measure you cannot use naked columns as DAX doesnt know what row(s) you are referring to. You can get away with that in Calculated Columns since calculated columns themselves has a row context, so dax "knows" what you row. 

 

If you create these measures it will work just fine:

Total Volume:=SUM ( Table1[Volume] )

Disct Count of Invoice Months:=DISTINCTCOUNT(Table1[Invoice date] )

Avg Monthly Volume:=DIVIDE(  [Total Volume] , [Disct Count of Invoice Months] )

Using DIVIDE is preferred vs / because if there is a divide by zero error DIVIDE will handle it.  

Divide.png

Anonymous
Not applicable

Thanks, why does not a calculated column work?

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.