cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AntanasK Frequent Visitor
Frequent Visitor

Fill empty cells based on criteria

Hi, 

i need some help. Here is my situation. In column "Customer No_" there are some empty cells some cells with numbers. I have a common column "Vidinio dok.nr.". Need that, if in column "Vidinio dok.nr." are the same value, all blank customer no cells will be filled with numbers, like in example P0812. Any thoughts?  thank you.

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
v-ljerr-msft Super Contributor
Super Contributor

Re: Fill empty cells based on criteria

Hi @AntanasK,

 

According to your description, you should be able to create a calculate column using DAX for the "Customer No_" column in this scenario. See my sample below.

 

I assume you have a table called "Table1" like below.

 

t1.PNG

 

Then you should be able to use the formula below to create the calculate column for the "Customer No_".

New Customer No_ = 
VAR vidInio = Table1[Vidinio dok.nr.]
RETURN
    CALCULATE (
        FIRSTNONBLANK ( Table1[Customer No_], 1 ),
        FILTER (
            ALL ( Table1 ),
            Table1[Vidinio dok.nr.] = vidInio
                && Table1[Customer No_] <> BLANK ()
                && Table1[Customer No_] <> ""
        )
    )

c1.PNG

 

Here is the sample pbix file for your reference.Smiley Happy

 

Regards

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Fill empty cells based on criteria

Filled with what numbers? Random numbers? Constant numbers or something from the data?


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

AntanasK Frequent Visitor
Frequent Visitor

Re: Fill empty cells based on criteria

Sorry. Filled with numbers from data. In column "Vidinio dok.nr." i have invoice numbers, also i have account numbers (G_L Account No_) and Customer No_.  Account numbers with the beginning 5 are incomes, others with 6 are costs. As i filter one invoice i.e. SFI100003 only incomes have customer numbers. I need that not only incomes but also costs will have the same cust no. And the same situation are with all invoices in my data. Hope that explained exactly.

Thank you.

Antanas 

v-ljerr-msft Super Contributor
Super Contributor

Re: Fill empty cells based on criteria

Hi @AntanasK,

 

According to your description, you should be able to create a calculate column using DAX for the "Customer No_" column in this scenario. See my sample below.

 

I assume you have a table called "Table1" like below.

 

t1.PNG

 

Then you should be able to use the formula below to create the calculate column for the "Customer No_".

New Customer No_ = 
VAR vidInio = Table1[Vidinio dok.nr.]
RETURN
    CALCULATE (
        FIRSTNONBLANK ( Table1[Customer No_], 1 ),
        FILTER (
            ALL ( Table1 ),
            Table1[Vidinio dok.nr.] = vidInio
                && Table1[Customer No_] <> BLANK ()
                && Table1[Customer No_] <> ""
        )
    )

c1.PNG

 

Here is the sample pbix file for your reference.Smiley Happy

 

Regards

View solution in original post

AntanasK Frequent Visitor
Frequent Visitor

Re: Fill empty cells based on criteria

Yes, that is what i need. Thank you very much for your help @v-ljerr-msft 

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 291 members 2,992 guests
Please welcome our newest community members: