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
OonaHaqq
New Member

Power Query: How to filter in a List.Max function to get maximum from only part of the data

Hello, I would like to filter the list of values before I get the max value.

 

I have 2 tables:

  • date dimension with months of current Fiscal Year
  • fact / transaction table with actual results and forecasts

picture.png

In Power Query I would like to add a custom column to the date dimension table with the maximum Month available for "Actual" Scenario from the fact table.

This syntax:  List.Max(#"Actuals Consolidation"[Month])

allowed me to add the maximum Month of the whole fact table table ~ 10/01/2023.

How can I add the filtering to the "Actual" Scenario, please?

When I try something like this:

= Table.AddColumn(#"Added Custom", "Custom.1", each List.Max(Table.SelectRows(#"Actuals Consolidation"[Month], each [Scenario] = "Actual")))

I get error that list cannot be converted to a table.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

I would suggest to do that in Power BI DAX instead. List.Max is a potentially very expensive operation that may break folding.

 

if you must - specify the column name at the end.

 

= Table.AddColumn(#"Added Custom", "Custom.1", each List.Max(Table.SelectRows(#"Actuals Consolidation", each [Scenario] = "Actual")[Month]))

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

I would suggest to do that in Power BI DAX instead. List.Max is a potentially very expensive operation that may break folding.

 

if you must - specify the column name at the end.

 

= Table.AddColumn(#"Added Custom", "Custom.1", each List.Max(Table.SelectRows(#"Actuals Consolidation", each [Scenario] = "Actual")[Month]))

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
Top Kudoed Authors