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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Martin_Bruwer
Frequent Visitor

Populate a new calculated column with data from within the same table DAX or M?

Evening All,

 

I have a scenario where I have appended three data tables together, each table has a field which the others need, but don't have naturally, for example a 'How Paid'. This field exists and is populated in my revenue table but not in the costs table it is appended with, I need it populated so I can easily check profitability by each payment method.

 

Sample Data

 

Transaction CodeHow PaidSource TableValue
555444777Credit CardRevenue Table500
555444777 Cost of Sales Table-200
555444777 3rd Table-100
888888888CashRevenue Table500
888888888 Cost of Sales Table-200
888888888 3rd Table-100
111111111Debit CardRevenue Table500
111111111 Cost of Sales Table-200
111111111 3rd Table-100

 

I need a new column, or a way of populating the blanks, for all three lines that is populated with the 'How Paid' from the Revenue Source.

 

Any ideas?

 

Thank you

 

Martin

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Martin_Bruwer

 

Try this column

 

Column =
CALCULATE (
    FIRSTNONBLANK ( Table1[How Paid], 1 ),
    ALLEXCEPT ( Table1, Table1[Transaction Code] )
)

View solution in original post

4 REPLIES 4
Martin_Bruwer
Frequent Visitor

Thank you both,

 

I am trying the DAX method at the moment, seems to be working just doing some testing and I'll accept as solution. Will try the Query solution soon after.

 

Thank you

 

Martin

Here is an alternative DAX column.  I found the FIRSTNONBLANK has issues with some datasets

 

Column = 
    MAXX(
        FILTER(
            'Table1',
            'Table1'[Transaction Code] = EARLIER('Table1'[Transaction Code]) 
            ),
        [How Paid]
        )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Phil_Seamark
Microsoft Employee
Microsoft Employee

In Power Query

 

1. Dupicate the table

2. Group the new table by Transaction code and add an aggregation to be MAX over column How Paid

3. Merge the new table into the orignal table joining on Transaction code.

 

I have attached a sample PBIX File

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Zubair_Muhammad
Community Champion
Community Champion

Hi @Martin_Bruwer

 

Try this column

 

Column =
CALCULATE (
    FIRSTNONBLANK ( Table1[How Paid], 1 ),
    ALLEXCEPT ( Table1, Table1[Transaction Code] )
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.