Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX & Empty Cells

Hey, so i'm trying to develop a DAX expression for day by day sales report but i'm having some trouble. Basically, some of the rows are empty because of store error or delay and my goal is to develop an expression where if there are more than 3 empty cells within a row, dont read it. Can this be done in dax?

 

Any help is appreciated, thanks in advance!

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Parry2k has provided a  nice solution. If you want to use dax,It's a little bit of a hassle if you have a lot of columns, You can try the following dax:

Measure =

VAR MaxBlank = 3

RETURN

    IF (

        CALCULATE (

            COUNTBLANK ( [COLUMN1] ) + COUNTBLANK ( [COLUMN2] )

                + COUNTBLANK ( [COLUMN3] )

        ) >= MaxBlank,

        1,

        0

    )

Best Regards,

Dedmon Dai

View solution in original post

6 REPLIES 6
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Parry2k has provided a  nice solution. If you want to use dax,It's a little bit of a hassle if you have a lot of columns, You can try the following dax:

Measure =

VAR MaxBlank = 3

RETURN

    IF (

        CALCULATE (

            COUNTBLANK ( [COLUMN1] ) + COUNTBLANK ( [COLUMN2] )

                + COUNTBLANK ( [COLUMN3] )

        ) >= MaxBlank,

        1,

        0

    )

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@Anonymous ,

if this empty you can use blank to check. if it has space you need to use trim

isblank([column]) is true when there is no data

coalesce([column],"1")

@amitchandak not sure how it is going to help, it is not about checking if a column is blank, it is to check if there 3 or more columns are blank...maybe I misread the post but that's what I think @Anonymous is looking for.



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.

parry2k
Super User
Super User

@Anonymous how many columns you have? It is possible to check all the columns value and if 3 or more have blank values, flag it out but I'm thinking to a more sleek solution rather than writing simple and long DAX method, and that's the reason it will be good to know how many # of columns we are dealing with?



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.

@Anonymous see attached, look at BlankExample table and fnCheckBlank function. Basically this fnCheckBlank function has 2nd parameter that you can pass on how many blank columns you want to check, 2 or 3 or 4 and you have a column with value Yes/No, Yes means # of blanks found in the row and now from here everything should be straight forward.

 

it is a dynamic solution and can be applied to any number of columns in a table and can check any number of blank columns.

 

PS - there are other tables in the attached pbix file, just ignore those.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

 

 



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.

mahoneypat
Employee
Employee

Yes.  Please provide sample data if you want a detailed response with an expression.  But basically, you can make a variable as part of the expression to get the date of the last non-empty value, and find the difference from the current date (for example).  If >=3, return blank, if <  3, do your calculation.

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.