Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have a table with text column that stores text and numbers. I have a view that filters the column to ignore the text and show the rows with numbers only. In that view I want to use the MAX function to return the largest values but since the column is text it yield unwanted results, for example intead of returning 10 it may return 3.
Is it possible to use an agregate function in a text column to yield returns as if it was a numeric column? I attempted embedding the VALUE and FORMAT function inside the MAX function but that didnt work.
Solved! Go to Solution.
Try this modified formula which should attempt to extract the number value from a text column and returns blank() if the execution results to an error:
Numeric Value = IF ( NOT ( ISERROR ( VALUE ( Table[AlphanumericColumn] ) ) ), VALUE ( Table[AlphanumericColumn] ) )
Proud to be a Super User!
Hi @Anonymous,
I don't think MAX calculation for non-numeric value is possible. I would suggest to create a calculated column to extract the numeric values in your text column. Example:
Numeric Value = IF ( ISNUMBER ( VALUE ( Table[AlphanumericColumn] ) ), VALUE ( Table[AlphanumericColumn] ) )
And then use this column to calculate for the max value.
Proud to be a Super User!
Hi @danextian
Thank you for your reply. I attempeted what you suggested but it complains that it cannot convert value of type Text to type Number.
try this
column = if(ticket_change[newvalue] = BLANK() || ticket_change[newvalue] = "", BLANK(), if(ISNUMBER(VALUE(ticket_change[newvalue])), VALUE(ticket_change[newvalue])))
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Try this modified formula which should attempt to extract the number value from a text column and returns blank() if the execution results to an error:
Numeric Value = IF ( NOT ( ISERROR ( VALUE ( Table[AlphanumericColumn] ) ) ), VALUE ( Table[AlphanumericColumn] ) )
Proud to be a Super User!
Thank you @danextian. That worked! I'm still learning DAX and greatly appreciate the resolution you provided.
This is what I attempted before but didnt work as it was giving me the max value as if it was a text and not a number; returning for MAX(ticket_change_newvalue) the value of 2 and not of 10 as I was expecting.
Estimate = FILTER ( SUMMARIZE ( ticket_change, ticket_change[ticket], ticket_change[field], "hours",MAXX(ticket_change, FORMAT(ticket_change[newvalue],"General Number")), "hours2",MAX(ticket_change[newvalue]), "datetime", MAX ( ticket_change[datetime] ) ), AND ( ticket_change[field] = "timeestimate", ticket_change[ticket]=10984 /*TRIM ( [hours] ) <> ""*/ ) )
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |