Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi there,
I'm pretty new to Dax, and am trying to get an If statement to work - I have 3 outcomes, and the data in the original field is numbers and blanks.
This is how far I've gotten but I'm seeing errors with Text vs integer data types.. Can anyone tell me what I need to do to get this to work?
Solved! Go to Solution.
Try
Open Vs Effective Date Buckets =
IF (
ISBLANK ( 'All ServiceNow Data'[Open Vs Effective Date] ),
"Invalid Effective Date",
IF (
'All ServiceNow Data'[Open Vs Effective Date] < 0,
"Opened Before Effective Date",
"Opened on/after Effective Date"
)
)
Thank you for your prompt relpy! johnt75
Hi @MeganLouise93
I'm trying to reproduce your error, when the 'Open Vs Effective Date' column type is Text, the error will occur.
You can use the following two methods to solve this problem.
First: Change the type from text to number
Second: Use Value function
Open Vs Effective Date Buckets =
IF (
ISBLANK ( VALUE('All ServiceNow Data'[Open Vs Effective Date] )),
"Invalid Effective Date",
IF (
VALUE('All ServiceNow Data'[Open Vs Effective Date] ) < 0,
"Opened Before Effective Date",
"Opened on/after Effective Date"
)
)
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your response - Johnt75's solution worked perfectly as I had already amended the fields to numbers 😄
Try
Open Vs Effective Date Buckets =
IF (
ISBLANK ( 'All ServiceNow Data'[Open Vs Effective Date] ),
"Invalid Effective Date",
IF (
'All ServiceNow Data'[Open Vs Effective Date] < 0,
"Opened Before Effective Date",
"Opened on/after Effective Date"
)
)
Thank you - Unfortunately this is still returning the error "DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values." 😔
Check the type of 'All ServiceNow Data'[Open Vs Effective Date] and make sure it is one of the numeric types, it sounds like it is text at the moment.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
10 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
8 |