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
claudedubois
Regular Visitor

Minif function that compares the date of a row to the date of all other rows

Hey everyone, 

 

I'm trying to populate the right hand column below. 

It calculates the minimum quantity purchased in the last twelve months from the date of every row.  

In excel, the function would be: minif (quantity column, description of all rows = description of current row, date of every row <= date of current row, date of every row >= (date of current row -365)

 

Struggling to translate the function to PBI? I guess it's shouldn't be a measure as every row has a separate value? Should it be a new column?

 

Any help would be greatly appreciated! thank you. 

 

claudedubois_0-1674752089513.png

 

1 ACCEPTED SOLUTION

@claudedubois 

Following is a calculated column 

Min QTY Last 12 Months =
MINX (
FILTER (
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Description] ) ),
'Table'[Date] <= EARLIER ( 'Table'[Date] )
&& 'Table'[Date]
> EARLIER ( 'Table'[Date] ) - 365
),
'Table'[Quantity]
)

View solution in original post

5 REPLIES 5
claudedubois
Regular Visitor

Hi @tamerj1 

 

This is super super helpful! Thanks a lot for the help, saved me 1 day of useless work trying to figure this out. 

 

I do have another function that is similar but a bit more complex? Can I pls ask for it?

@claudedubois 
Yes, please go ahead.

claudedubois
Regular Visitor

Yes sir my bad

@claudedubois 

Following is a calculated column 

Min QTY Last 12 Months =
MINX (
FILTER (
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Description] ) ),
'Table'[Date] <= EARLIER ( 'Table'[Date] )
&& 'Table'[Date]
> EARLIER ( 'Table'[Date] ) - 365
),
'Table'[Quantity]
)

tamerj1
Super User
Super User

Hi @claudedubois 

Coffee 10-Dec-22 should be 9?

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