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
Allow to use service principal for VNet data gateway connection to SQL Server
Service principal authentication is not supported for Azure SQL server connections when using an on-premises data gateway or a virtual network (VNet) data gateway. As a result we have to fallback to ...Andrei-Sokalau33 minutes agoNew MemberNew2Views0likes0CommentsProvide a Read-Only / Source-Safe Mode for Schema Shortcuts in Lakehouse
Schema Shortcuts provide a much better management experience than individual Table Shortcuts because they preserve the source schema structure and allow multiple tables to be onboarded at once. Howev...Junghyoen3 hours agoMicrosoft EmployeeNew21Views8likes0CommentsAccess Variable Library in Semantic Models
Enable the Variable Library as a centralized location for storing all environment‑specific variables, allowing us to adjust them for promotion scenarios (e.g., from dev to prod) without relying on de...FreddyH14 hours agoAdvocate IINew920Views31likes2CommentsEnhance Fabric Pipeline Monitoring with Parent-Child Pipeline Lineage and Parameter Visibility
Currently, Microsoft Fabric Pipeline monitoring lacks several capabilities that are available in Azure Data Factory, making troubleshooting and operational support challenging in enterprise environme...dwramreddy14 hours agoRegular VisitorNew8Views0likes0CommentsDynamic ADLS-Gen2 path input for Spark Jobs Main definition file
I would like the ability to add a dynamic input box on a spark job definition's "Main Definition File" "ADLS-Gen2 path". this would be useful to set base and variable paths across all spark jobs...mfink_db19 hours agoNew MemberNew238Views2likes2Comments