Forum Discussion
If statement error "Dax comparison operators do not support comparing values of type text
I am receiving an error on trying to create an IF statement:
12 Replies
- ryan_mayu
Super User
we can only have one type for one column. So we can't have text which is Open and number which are 1,2,3,4.
may be you can try this:
Resoultion Time Status =IF([Granulated] = "OPEN" , "OPEN",IF([Granulated] *1<=1 ."24 hours",IF([Granulated] *1<=2, "48 hours",IF([Granulated] *1<=3, "72 hours",IF([Granulated] *1<=4, "96 hours",">5 days")))))- AnonymousNot applicable
Thank you so much it worked, could you explain the logic behind adding [Granulated] *1?
- AnonymousNot applicable
I tried adding it to the table visual, but it only gives me two column fields "open" and "24 hours" as below:
- v-zhangti
Community Support
Hi, appsac1
You can try the following methods.
Resoultion Time Status = IF( [Granulated] = "OPEN" , "OPEN", IF( VALUE([Granulated]) <=1, "24 hours", IF( VALUE([Granulated])<=2, "48 hours", IF( VALUE([Granulated])<=3, "72 hours", IF( VALUE([Granulated]) <=4, "96 hours", ">5 days")))))Is this the output you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
The issue is with my Granulated measure not working, because of which the results for Resolution time status shows just as 24 hours and Open.
Below is the measure that I created for Granulated:I don't have an option to upload my pbix file on the forum, I am sharing the workspace link
https://app.powerbi.com/groups/me/reports/080c3ce8-6d27-4120-8721-e6824f854b43/ReportSection- AnonymousNot applicable
I fixed this temporarily by replacing open in the Granulated formulae by 0
Old - Granulated = IF(ISBLANK('April Tickets'[Resolved time].[Date]),FORMAT( "open" , ([Resolved time].[Date] - [Created time].[Date])*1.))New -
Granulated = IF(ISBLANK('April Tickets'[Resolved time].[Date]), 0 , DATEDIFF('April Tickets'[Created time],'April Tickets'[Resolved time],DAY))But I want open and not o to show in my table and I am unable to find a way to have both text and int. The format option isn't working.
- AnonymousNot applicable
Sure, below is the measure code
Granulated = IF(ISBLANK('April Tickets'[Resolved time].[Date]),FORMAT( "open" , ([Resolved time].[Date] - [Created time].[Date])*1.))