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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
dsalony
Helper I
Helper I

Indexing a value

I have data that has a value that has two attributes:

  • the value is '# of people'
  • one attribute is Building Name
  • other attribute is Leader Name

 

so something like this:

dsalony_0-1657917298132.png

the column 'primary' is the column I am trying to derive with DAX.  Using Excel, since it is cell-based, it is easy to accomplish using nested INDEX, MATCH, and MAX functions across the rows, but since PowerBI is column-based, I can't replicate.  I have the data structured in the first three columns.  how do I generate the fourth column, which returns the name of the leader cross-referenced with the building, who has the majority share of people in each building?

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @dsalony ,

 

Please try:

 

 

Primary =

var _maxpeople = MAXX(FILTER('Table',[Building]=EARLIER('Table'[Building])),[People])

return MAXX(FILTER('Table',[Building]=EARLIER('Table'[Building])&&[People]=_maxpeople),[Leader])

 

 

 

Output:

vjianbolimsft_0-1658224950116.png

 

Best Regards,

Jianbo Li

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

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @dsalony ,

 

Please try:

 

 

Primary =

var _maxpeople = MAXX(FILTER('Table',[Building]=EARLIER('Table'[Building])),[People])

return MAXX(FILTER('Table',[Building]=EARLIER('Table'[Building])&&[People]=_maxpeople),[Leader])

 

 

 

Output:

vjianbolimsft_0-1658224950116.png

 

Best Regards,

Jianbo Li

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

thanks, that worked!

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=LOOKUPVALUE(Data[Leader],Data[People],CALCULATE(MAX(Data[People]),FILTER(Data,Data[Building]=EARLIER(Data[Building]))),Data[Building],Data[Building])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.