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.
Hey,
I am trying to Filter last year sales, but I am getting an error. Please see below for my formula.
2018 Forecast =
CALCULATE([Total Sales],
FILTER(Dates, Dates[Sales Data].[Year] = "2018"))
Error -
Please click here for the sample file.
Can anybody please tell me what I am doing wrong?
Thank you so much
Solved! Go to Solution.
@Anonymous -
It looks like you've enclosed "2018" as a text string. Take out the quotes or change the Data Type to Text
Proud to be a Super User!
You have quotes around the value 2018 which tells DAX to treat that value as text instead of a number. Removing the quotes around 2018 should fix this issue.
eg
2018 Forecast =
CALCULATE([Total Sales],
FILTER(Dates, Dates[Sales Data].[Year] = 2018 ))
Hi @Anonymous ,
Dates[Sales Data].[Year] returns a value(whole number), but "2018" is text so they are different types.
So you need to use Dates[Sales Data].[Year] = 2018 or FORMAT(Dates[Sales Data].[Year],"0000") = "2018".
Thank you all for your help. I really appreciate it.
Hi @Anonymous ,
Dates[Sales Data].[Year] returns a value(whole number), but "2018" is text so they are different types.
So you need to use Dates[Sales Data].[Year] = 2018 or FORMAT(Dates[Sales Data].[Year],"0000") = "2018".
You have quotes around the value 2018 which tells DAX to treat that value as text instead of a number. Removing the quotes around 2018 should fix this issue.
eg
2018 Forecast =
CALCULATE([Total Sales],
FILTER(Dates, Dates[Sales Data].[Year] = 2018 ))
@Anonymous -
It looks like you've enclosed "2018" as a text string. Take out the quotes or change the Data Type to Text
Proud to be a Super User!
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 |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |