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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
nkasdali
Microsoft Employee
Microsoft Employee

Calculated Issue

Hi all,

 

i'm facing a strange situation with a measure, so let me explain.

 

Here my measure :

Default year = year(max('Calendar'[Date]))

Default Month = MONTH(max('Calendar'[Date]))

Sales Default 2 = CALCULATE(sum(Sales[ Sales]);
FILTER('Calendar';'Calendar'[Year]= [Default year] && 'Calendar'[Month]=[Default Month]))

so the aim is to get the last value of my Month and Year, in my table my last month is 12 and year 2017, this will give me 12 385 113€.

But !! in my measure i dont have this number, i have the sum of all my data :

Capture.JPG

 

Can you help me please

 

thanks

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

So you're just wanting the sum of sales for the last month on your calendar table? Why not try something like:

 

Sales Default 2 = 

var lastdateinsample = max('Calendar'[Date])

var relatedmonth = startofmonth(lastdateinsample)

return calculate(sum(Sales[ Sales]);'Calendar'[Date]>=relatedmonth)

View solution in original post

2 REPLIES 2
jthomson
Solution Sage
Solution Sage

So you're just wanting the sum of sales for the last month on your calendar table? Why not try something like:

 

Sales Default 2 = 

var lastdateinsample = max('Calendar'[Date])

var relatedmonth = startofmonth(lastdateinsample)

return calculate(sum(Sales[ Sales]);'Calendar'[Date]>=relatedmonth)

This is it !! using variables 🙂

 

Thanks @jthomson, it works well nos 🙂

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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