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

Return Column Name of Last Non-zero value in row range

Hi all - I am attempting to recreate a formulated column I have in excel to DAX language.  I have had a lot of luck googling other power bi queries, but I can't find anything on this.  I am using the lookup function in excel, but i can't find the equivalent in DAX.  Dax has a "lookupvalue" fuction but this does not seem to work the same.

The custom column needs to be populated by the "column name" corresponding to the last "non-zero" value in a row.  Example is below of the excel version of the formula.  Does anyone know how to make this same calculation with a custom DAX column in Power BI?  

 

=LOOKUP(2,1/(Table1[@[FY2021]:[FY2031]]<>0),RIGHT(Table1[[#Headers],[FY2021]:[FY2031]],4))

 

AliForrester1_0-1619366637467.png

 

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please correct me if I wrongly understood your question.

In order to create the table like above, the first step that I generally take is to transform the table like below.

 

Picture2.png

 

Then, the lookup tables are created (in general), and the relationships can be created like below.

 

Picture3.png

 

All measures for creating the below visualization are in the sample pbix file, and the link is down below.

Picture4.png

 

 

https://www.dropbox.com/s/rm9xeguaegqvpc5/ali.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.

Top Solution Authors