cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
olives
Helper I
Helper I

Get max date with conditions by Query

Hi,

 

I have a Calendar table and I am trying to get max date with conditions by Query.

How can I get 1/3/2021 (max date & holiday=1)?

 

Calendar table

dateholiday
1/1/20211
1/2/20211
1/3/20211
1/4/20210
1/5/20210

 

I have try this but those are returning  1/5/2021.

 

= List.Max(Calendar[date], each [holiday]= 1)
= List.Max(Calendar[date], each [holiday]= 0)

 

 

Any help would be greatly appreciated.

2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

=List.Max(Table.SelectRows(Calendar,each [holiday]=1)[date])

View solution in original post

watkinnc
Super User
Super User

You could also just use Table.Max, which lets you use two parameters, like

 

=Table.Max(PriorStepOrTableName, {"Date", "Holiday"})

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

You could also just use Table.Max, which lets you use two parameters, like

 

=Table.Max(PriorStepOrTableName, {"Date", "Holiday"})

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
wdx223_Daniel
Super User
Super User

=List.Max(Table.SelectRows(Calendar,each [holiday]=1)[date])

@wdx223_Daniel 
Thank you😊

It worked😀

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors