Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I have this measure and can't really figure out, why is it not working. I get error "A table of multiple values was supplied were a single value was expected".
Sum Sales = CALCULATE ( SUM ( Sales[Amount] ), FILTER ( ALL ( 'Date' ), DATESBETWEEN ( 'Date'[Date], DATE (2017,1,1), DATE(2017,9,30) ) ) )
Try this
Sum Sales = CALCULATE ( SUM ( Sales[Amount] ), DATESBETWEEN ( 'Date'[Date], DATE (2017,1,1), DATE(2017,9,30) )
OK. But how come this works and FILTER doesn't? Doesn't your CALCULATE translates internally to my CALCULATE with FILTER ?
@gvg wrote:OK. But how come this works and FILTER doesn't? Doesn't your CALCULATE translates internally to my CALCULATE with FILTER ?
CALCULATE has 2 syntaxes
Simple syntax - this is what you are describing where the simple syntax is converted to the full syntax you mentioned.
Advanced (or table) syntax - this is what my formula does - it takes a table as a filter to CALCULATE. DATESBETWEEN returns a table of dates. Whenever you get a table, you must use it directly in CALCULATE (advanced syntax).
Advanced (or table) syntax
OK. But doesn't FILTER return a table as well?
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |