Forum Discussion
If blank dax statement
Hi, i have a column that creates some HTML out of a number of text fields. If a filed is null, I would like to return the text "no update received" instead of a blank entry. How would i amend the following code to achieve that?
zzProjectDetailsHTMLConcatenate-KH-NextSteps- = "<h1>" & "TEXT FIELD 1" & "</h1>"& "<p>" & 'Projects (2)'[XXX] & "</p>"& "<h1>" & "<hr>" & "TEXT FIELD 2" & "</h1>"& "<p>" & 'Projects (2)'[ZZZ] & "<hr>"
Hi Anonymous ,
We can use the following formula to meet your requirement:
zzProjectDetailsHTMLConcatenate-KH-NextSteps- = VAR XXX = IF ( ISBLANK ( 'Projects (2)'[XXX] ) || 'Projects (2)'[XXX] = "", "no update received", 'Projects (2)'[XXX] ) VAR ZZZ = IF ( ISBLANK ( 'Projects (2)'[ZZZ] ) || 'Projects (2)'[ZZZ] = "", "no update received", 'Projects (2)'[ZZZ] ) RETURN "<h1>" & "TEXT FIELD 1" & "</h1>" & "<p>" & XXX & "</p>" & "<h1>" & "<hr>" & "TEXT FIELD 2" & "</h1>" & "<p>" & ZZZ & "<hr>"If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
BTW, pbix as attached.Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- v-lid-msftCommunity Support
Hi Anonymous ,
We can use the following formula to meet your requirement:
zzProjectDetailsHTMLConcatenate-KH-NextSteps- = VAR XXX = IF ( ISBLANK ( 'Projects (2)'[XXX] ) || 'Projects (2)'[XXX] = "", "no update received", 'Projects (2)'[XXX] ) VAR ZZZ = IF ( ISBLANK ( 'Projects (2)'[ZZZ] ) || 'Projects (2)'[ZZZ] = "", "no update received", 'Projects (2)'[ZZZ] ) RETURN "<h1>" & "TEXT FIELD 1" & "</h1>" & "<p>" & XXX & "</p>" & "<h1>" & "<hr>" & "TEXT FIELD 2" & "</h1>" & "<p>" & ZZZ & "<hr>"If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
BTW, pbix as attached.Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Many thanks, this works as expected. COuld you explain the following part of the code, i am unsure why there is both the ISBLANK and the =""
ISBLANK ( 'Projects (2)'[ZZZ] ) || 'Projects (2)'[ZZZ] = "",- v-lid-msftCommunity Support
Hi Anonymous ,
Because in some text column, the value could be empty string or blank value, we use both to ensure that we can get all the blank value, it should be the same result if just use ="":
Best regards,
- AnonymousNot applicable
You can add this to the expression you already wrote:
IF(ISBLANK([Value]);"no update received";[Value])
Kind regards
Joren Venema
Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily.