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

Filling in the blanks...

I have heard I can use an IF with ISBLANK to fill in blanks is a table and supply more info if I supply a more detailed use case.

So here it is:

a table with blanks and values without blanks that contain the key named groupid

name  groupid

 

blank           10

microsoft  10

microsoft  10

blank           10

blank           10

amazon      12

blank           12

 

the end result:

microsoft   10

microsoft  10

microsoft  10

microsoft  10

microsoft  10

amazon      12

amazon      12

 

 

Thanks!

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check:

 

Column =
VAR LastNonBlankDate =
    CALCULATE (
        LASTNONBLANK ( 'Table'[groupid], 1 ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[groupid] = EARLIER ( 'Table'[groupid] )
                && NOT ( ISBLANK ( 'Table'[name] ) )
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[name] ),
        FILTER ( ALL ( 'Table' ), 'Table'[groupid] = LastNonBlankDate )
    )

fill down.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check:

 

Column =
VAR LastNonBlankDate =
    CALCULATE (
        LASTNONBLANK ( 'Table'[groupid], 1 ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[groupid] = EARLIER ( 'Table'[groupid] )
                && NOT ( ISBLANK ( 'Table'[name] ) )
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[name] ),
        FILTER ( ALL ( 'Table' ), 'Table'[groupid] = LastNonBlankDate )
    )

fill down.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Ok I added an IF THEN for the use case of where the groupid was 0. I put it in front of the CALCULATE.

 

Great job!!

Anonymous
Not applicable

This was well done and I almost hate to ask but how would you modify it put in blank as a default value for the groupid say 0?

 

Many Thanks!

Anonymous
Not applicable

Hi Icey,

I tried putting this in the dialog box for creating a custom column and I am getting an Eof error as shown below.

 

powerqueryerror.png

 

 
Anonymous
Not applicable

Ok. Seems Power Query will not work with this but new Column will. I did not realize this limitation. I do not get this error when I use this.

 

Many Thanks now back to testing this.

FrankAT
Community Champion
Community Champion

Hi @Anonymous ,

you can do this with Power Query:

  1. Select the column with Blanks.
  2. Tab Transform > Fill > Fill Down | Fill Up.

Regrads FrankAT

Anonymous
Not applicable

I saw that earlier but I gave a simple use case. I amm wondering how does that work if you do not specify a key that is shared like I gave but a real table may have the key in one column of say 40. So how does the fill handle that?

 

Thanks,

-Tony

Not sure I get what you are saying here. You want to fill a column that has blanks but that what you want to fill with comes from a different column?

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Ok I think this will get me what I want but getting eof error on the first bracket. My thought process is get the group id for the current record then use that id get the last non blank record name that has the same group id which gets put into the new column at the same position as the record that has the gid value.

=

VAR gid = [GROUPID]
RETURN
LASTNONBLANK([ORGANIZATIONNAME],GROUPID = gid))

Anonymous
Not applicable

Correct. When there is a blank I want to fill it or create a new column with data value for that same row with the blank column but it has a value that came from another row with the same key but a non blank value.

 

I hope that helps

 

Anonymous
Not applicable

So in my example there were two rows with blanks with the groupid of 10 and so what I would do is take another row with groupid of ten that has a nonblank name in the case 'microsoft' and fill it in or as you suggested create a new column and place the name there for the same row that has a groupid of 10 and the blank name.

 

Thanks!

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.