Forum Discussion
How to reference a zero length string
- 1 year ago
Please download this PBIX onfrom Onedrive
The input data contains a record with each type of value:-
- null
- empty
- 1 space
- 2 spaces
- 3 spaces
- and text
The first interesting thing is that Power BI automatically trims any trailing spaces in text data types.
Learn here https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-data-types
This means that the 1 space, 2 space and 3 space values will be all be converted to empty !
The next interest thing is that null and empty are treated differently
ISBLANK(measure) will just detect null
see https://learn.microsoft.com/en-us/dax/isblank-function-daxWhereas IF(measure = BLANK() treates null and empty as the same !
Answer1 = VAR myvalue = MIN(Yourdata[Value]) RETURN SWITCH(TRUE(), ISBLANK(myvalue), 1, myvalue = "", 2, myvalue = " ",3, 4 )Answer2 = VAR myvalue = MIN(Yourdata[Value]) RETURN SWITCH(TRUE(), myvalue = BLANK(), 1, myvalue = "", 2, myvalue = " ",3, 4 )If you are ever in doubt then edit and play with the example I provided
Please clcik thumbs up and accept solution buttton
Zero length string is "". Null is BLANK().
You can do checks like
IF ( OR ( ISBLANK( [Col1] ), [Col1] = "" ), "N/A", [Col1] )
IF ( LEN ( [Col1] ) = 0, "N/A", [Col1] )
IF ( [Col1] = BLANK(), "N/A", [Col1] )
I don't recommend the last one since "" = BLANK() is true but "" == BLANK() is false.
- ipisors1 year agoNew Member
=blank() is not working in a Filtered Rows fx
I'm using
= Table.SelectRows(dbo_tbl_PatientVisit_Allergy, each [Description] = Blank() or [Description] = "Unknown")
but it says "the name Blank wasn't recognized
- speedramps1 year ago
Super User
ipisors
you are getting confussed between Power Query "M" and DAX.
They are 2 different programming languages and handles spaces differentlyBlank() is a DAX command
You can learn Power Query "M" by clicking the column arrow and then apply or remove filters.the M code is then displayed ...