DAX - CALCULATE and SUMX

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hello

I have written a formula which calculates completion dates in August and this works fine.

I tried to have a go at rewriting it using SUMX but i get this error " "A table of multiple values was supplied where a single value was expected"

CALCULATE formula =
Code:
Completions August = CALCULATE(Count('Learning Plan'[Completion Date]),
                     DATESBETWEEN('Learning Plan'[Completion Date],
                     DATE(2023,8,1),
                     DATE(2023,8,31)
                     )
                     ,  'Learning Plan'[EPA Grade]="Distinction"
)


SUMX version

Code:
sumxAugCompletions = COUNTX(FILTER('Learning Plan',  DATESBETWEEN('Learning Plan'[Completion Date],
                     DATE(2023,8,1),
                     DATE(2023,8,31)
                     )),[Countofcomp])
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi WishMaster.

FILTER(<table>,<filter>) --> Returns a Table.

DATESBETWEEN(<Dates>,<StartDate>,<EndDate>) --> Returns a table.

Your version has DatesBetween in the filter position of the FILTER function.

i.e. the error message "A table of multiple values was supplied where a single value was expected" is referring to the second parameter of FILTER function.
 
Upvote 0
Hi WishMaster.

FILTER(<table>,<filter>) --> Returns a Table.

DATESBETWEEN(<Dates>,<StartDate>,<EndDate>) --> Returns a table.

Your version has DatesBetween in the filter position of the FILTER function.

i.e. the error message "A table of multiple values was supplied where a single value was expected" is referring to the second parameter of FILTER function.
Hello thankyou for your reply, yes thats right the datesbetween is in the filter function as i want to filter completion dates between 01/08 and 31/08 like i do in the calculate function. Is there any way to fix this?
 
Upvote 0
Struggling to do this without access to the report, but how about removing the FILTER function and just using DATESBETWEEN? They both produce a table output.
 
Upvote 0
Struggling to do this without access to the report, but how about removing the FILTER function and just using DATESBETWEEN? They both produce a table output.
Thanks for the suggestion, i will try tomorrow.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top