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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Calculatetable that filter by last day of each FY and product

Hi al

I've got a table were some KPIs are recorded as a snapshot of them to track the changes in time of it. something like this:

 ProductforescatactualFYdate
 P150001912/05/19
 P220001001912/05/19
 P1500101901/05/20
 P220003501901/05/20
 P15501501903/05/20
 P222505001903/05/20
 P15502502004/05/20
 P222506002004/05/20
 P15503002005/05/20
 P222506502005/05/20

 

I'd like to get a table that filters this one to show just the last values. I mean, the last values for each product for each FY. So the expected result would be:

 

ProductforescatactualFYdate
P15501501903/05/20
P222505001903/05/20
P15503002005/05/20
P222506502005/05/20

 

I'm trying this:

 

 

LastWeekly = 
    CALCULATETABLE(
        Weekly,
        Weekly[FY] IN DISTINCT(Weekly[FY],
        Weekly[Product] IN DISTINCT(Weekly[Product]),
        LASTDATE(Weekly[Date])
    )

 

but the last date for each FY it's not working and I got just the last date. I don't get any row from FY 19.

 

 

Appreciate your help

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous Here is my approach 

First create a measure in your original table 

Measure = 
VAR _maxdate = CALCULATE(MAX('Table'[date]),ALLEXCEPT('Table','Table'[Product],'Table'[FY]))
RETURN IF(MAX('Table'[date])=_maxdate,1)

 

Then create a calculated table from modeling tab

Table 2 = FILTER('Table',[Measure]=1)

 Let me know if have any question

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

Just try this formula as below:

New LastWeekly = 
    CALCULATETABLE(
        Weekly,
      FILTER(Weekly,Weekly[date]=CALCULATE(LASTDATE(Weekly[date]),FILTER(Weekly,Weekly[FY]=EARLIER(Weekly[FY]))))
)

Result:

4.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

great!! both solution works fine!!

Thanks!!

 

Now I'm looking to be able to make a total sum of the columns, forecast for example to use a slicers and get the results by product and FY. I got key tables for both product and FY to filter from and realation between tables are done. I used SUMX but seems it's not working. Any clue?

Anonymous
Not applicable

@Anonymous Here is my approach 

First create a measure in your original table 

Measure = 
VAR _maxdate = CALCULATE(MAX('Table'[date]),ALLEXCEPT('Table','Table'[Product],'Table'[FY]))
RETURN IF(MAX('Table'[date])=_maxdate,1)

 

Then create a calculated table from modeling tab

Table 2 = FILTER('Table',[Measure]=1)

 Let me know if have any question

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.