Reply
jobf
Helper I
Helper I
Partially syndicated - Outbound

LOOKUPVALUE with multiple conditions

Hello. I need to create a column that takes values ​​from a column based on more than one condition. Example:

VarietyPeriodBags
P1M120
P2M159
P3M101
P4P90
P5P95


I needed to create a column that showed the variety whose bags were larger in a given period. It would look something like this:

VarietyPeriodBags V + P
P1M120P2
P2M159P2
P3M101P2
P4P90P5
P5P95P5
2 ACCEPTED SOLUTIONS
uzuntasgokberk
Super User
Super User

Syndicated - Outbound

Hello @jobf,

 

You can use below DAX formula.

"

pbısupportgokberkuzuntas =
Var maxval_=
CALCULATE(
MAX(Tablesil1[Bags]),
ALLEXCEPT(Tablesil1,
Tablesil1[Periods]
)
)
RETURN
LOOKUPVALUE(Tablesil1[Variety],Tablesil1[Bags],maxval_)
"

Best Regards,
Gökberk Uzuntaş

LinkedIn: https://www.linkedin.com/in/g%C3%B6kberk-uzunta%C5%9F-b43906198/

Medium: https://medium.com/@uzuntasgokberk

 

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

View solution in original post

ryan_mayu
Super User
Super User

Syndicated - Outbound

@jobf 

you can try this

 

Column =
maxx(FILTER('Table','Table'[Period]=EARLIER('Table'[Period])&&'Table'[Bags]=maxx(FILTER('Table','Table'[Period]=EARLIER('Table'[Period])),'Table'[Bags])),'Table'[Variety])
 
11.PNG
 




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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Syndicated - Outbound

Hi,

Write this calculated column formula

Column = LOOKUPVALUE(Data[Variety],Data[Bags],CALCULATE(MAX(Data[Bags]),FILTER(Data,Data[Period]=EARLIER(Data[Period]))),Data[Period],Data[Period])

Hope this helps.

Ashish_Mathur_0-1725332704880.png

 


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

Syndicated - Outbound

@jobf 

you can try this

 

Column =
maxx(FILTER('Table','Table'[Period]=EARLIER('Table'[Period])&&'Table'[Bags]=maxx(FILTER('Table','Table'[Period]=EARLIER('Table'[Period])),'Table'[Bags])),'Table'[Variety])
 
11.PNG
 




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

Proud to be a Super User!




uzuntasgokberk
Super User
Super User

Syndicated - Outbound

Hello @jobf,

 

You can use below DAX formula.

"

pbısupportgokberkuzuntas =
Var maxval_=
CALCULATE(
MAX(Tablesil1[Bags]),
ALLEXCEPT(Tablesil1,
Tablesil1[Periods]
)
)
RETURN
LOOKUPVALUE(Tablesil1[Variety],Tablesil1[Bags],maxval_)
"

Best Regards,
Gökberk Uzuntaş

LinkedIn: https://www.linkedin.com/in/g%C3%B6kberk-uzunta%C5%9F-b43906198/

Medium: https://medium.com/@uzuntasgokberk

 

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

avatar user

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.

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)