Limits in formulas because of datatype Hi! I dont know if its only me having this problem but in excel I have never had difficulties creating advanced formulas with different types of data, for example making a sum (value) when I find a specific word (text). In Power BI I have set the datatype the same for several columns of which I need to create new calculated columns for in my report. But when trying to add a new formula column i get the error that the formula cant work with different datatypes (expressions that yield variant data-type cannot be used to define calculated columns). First of all I dont know if there is a background set that mess up the datatype though I have set the same format for all the data. Second it is possible to create the same formula I have made in excel, which works perfectly. I don't see the problem why it shouldn't work in Power BI?
5 Comments
- colinbanfield1New MemberI'm afraid that the likelihood of this request being accepted is very low. M is a fairly strongly typed language by design. Strongly typed systems not support type coercion because it is dangerous and error prone. You must explicitly convert a number stored as text to a number, for example, if you want use the text number with other real numeric data.
- ella_halden1New MemberAnd I don't know which data it refers to either though it does not name the data that is supposed to have the wrong datatype
- ella_halden1New MemberBut I believe there should be a difference between the Query editor language and the "new measure/New column" in the report view. I can understand if this blocks measueres in the query editor but if I have set all the data with the same datatype according to the "Data" view, it should not claim that the datatype is wrong when trying to create a simple formula for a new column or measure in the report view. If it does it should show me which value is wrong so that I can analyze why it's doing this, now I can't even understand why PBI is claiming that the datatype is wrong when it should not be.
- hdfulks1New MemberI've found that the typical problem is often in mixing the data types that are generated by the logical calculation will cause this error. Be sure to create consistent data type results in your formulas. I was evaluating bit columns and converting the result to a string but left the last logical check result equal to a zero. Changing it to "None" fixed the type error. Hope that helps.
- fbcideas_migusrNew MemberStatus added:Needs Votes
Recent ideas
About "Download SQL database project" and fix the downloaded project
1. The sqlproj must be fixed, it is downloaded without the xml markup line <?xml version="1.0" encoding="utf-8"> 2. The sdk must be updated: Actual: <Sdk Name="Microsoft.Build.Sql" Version="0.1...Jarrinf3 hours agoFrequent VisitorNew48Views3likes2CommentsEventstream MQTT broker source: V3.1.1 support
The Eventstream MQTT broker source supports connections with public MQTT brokers that offer MQTT V5 support. Please offer support for V3.1.1 too, because this is still a valid and widely used ver...svelde5 hours agoSuper UserCompleted1.4KViews6likes4CommentsGet data from Apache Kafka topics via private networking
Current prerequisites limit to public Kafka instances which is not feasible for most enterprise customers. When will this limitation be lifted so that it can be used in private network setups, for ...Jugi5 hours agoMicrosoft EmployeePlanned3.5KViews2likes3CommentsSet default x axis scrolling position
Enable selection of the default scroll position for the x-axis on a chart. For example, on a line chart with dates as the x-axis, when not all of the data can display in the view at once, the scroll...Lisa_Krieg13 hours agoNew MemberNeeds Votes7.8KViews1154likes104Comments