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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
paris
Helper V
Helper V

LASTDATE

Hi All,

 

Please help!! I was almost there and always find something small causes problem!

 

I have Monthly F'cast table and Sales table. I was able to calculate 7 days average by city but I also want to display 7 days average by region. When I calculate, I get 7 days average of the city in the bottom of vizualization table is shown as outcome. (Tokyo's 3 for this case...) 

 

Please help! my calculation for this is.... 

 

7 days MA = CALCULATE(Sales[7 days MA],LASTDATE(CALENDER[DATE]))

 

QA.JPG

 

All the best, 

LoveParis

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @paris ,

The problem you are running into is filter context.  On the total row for the matrix, because there is no city or region, so CALCULATE(Sales[7 days MA],LASTDATE(CALENDER[DATE])) is getting the last date from the calendar an only calcing for that date

You are going to end up with something like

 

MA = AVERAGEX ( VALUES ( Sales[City] ), [7 days MA] )

Are you able to share your .pbix file (uploade it to OneDrive or DropBox and share the link)?

 

 

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @paris ,

The problem you are running into is filter context.  On the total row for the matrix, because there is no city or region, so CALCULATE(Sales[7 days MA],LASTDATE(CALENDER[DATE])) is getting the last date from the calendar an only calcing for that date

You are going to end up with something like

 

MA = AVERAGEX ( VALUES ( Sales[City] ), [7 days MA] )

Are you able to share your .pbix file (uploade it to OneDrive or DropBox and share the link)?

 

 

Thank you for your help!

 

All the best,

LoveParis

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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