Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am trying to take the selected value from a year slicer and use it in a SEARCH function. I cannot seem to get the DAX right to make the data types match for the comparison. I have tried the CONVERT function also, but I still get the same error (below). Anyone who can show me where I am going wrong with this? Thanks.
Also, which is the better option for searching for that year? SEARCH or CONTAINSTRING?
Solved! Go to Solution.
@MarkD1722 , Instead of General change the formula with number like
SelectedYearString = FORMAT(SelectedYear, "0")
Proud to be a Super User! |
|
@MarkD1722 , Instead of General change the formula with number like
SelectedYearString = FORMAT(SelectedYear, "0")
Proud to be a Super User! |
|
This worked, but I would never have known to use that.
Separately, I used CONTAINSSTRING for my logical test instead of SEARCH after looking more closely at both.
Thanks for the suggestion.
Hi @MarkD1722 ,
What about swapping "General Number" with "yyyy" so that it will be regarded as a string (text format) in your dax formula?
Best regards,
I did try that, but it did not produce the same results as using the "0". I would have expected your suggestion to make more sense. Not sure why that didn't work the same way. Thank you for the suggestion.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.