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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ilyav
Frequent Visitor

DAX to find last non blank column in a given row

Hi Everyone,

 

I have a DAX question, my use case is that I have multiple rows and unknown number of columns (could be between 5-15), the data is generated by a Python script with a single input and generates an ouput with varying number of columns.

 

I need to find the last column in a given row that has value in it from a conditional column.

 

Here is an example of the data as reference and the desired output 'Total' which takes the last non blank value from the last 'Child' column that has values.

 

ilyav_0-1670853461152.png

 

Appreciate any help with this!

 

Thanks,

Ilya

2 REPLIES 2
ilyav
Frequent Visitor

@Manoj_Nair Thank you very much for the reply!

I guess that will solve the static case if I have a fixed number of columns. What will happen to the code if I have an additional column or less 2 columns? As I wrote, the number of "Childs" is dynamic and I need to find a way to deal with it dynamically in DAX (or M code) 🙂 

 

BR,

Ilya

 

 

Manoj_Nair
Solution Supplier
Solution Supplier

@ilyav - pls try this DAX, we used Coalesce.

Let me know if this resolve your issues then please mark as Solution Accepted. Many Thanks

image.jpg

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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