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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Charline_74
Helper III
Helper III

Measure + Date

Hello 
I need to create measures enabling me to obtain
the sum of my sales :
- the current month -2 months from last year (for example, it's November 2023 and I want to display my total sales for September 2022)
- the last month of last year (e.g. it's 2023, I want to display my total sales for December 2022)
- the current month -1 month (e.g. it's November 2023, I want to display my total sales for October 2023)
- the current month

I need these measures to be dynamic.

I have a table with a sales column and a date column.

1 REPLY 1
Anonymous
Not applicable

sales for current month -14 months 
var a = min(date[date])  -- to get the minimum selected Date
_StartDate = EDATE(a,-14)  -- startdate Before 14 months

_Enddate = EOMONTH (_StartDate,0)  -- EndDate of 14th month
 return calculate(sum[Sales],FILTER(ALL('Date'),'Date'[Date] >=_StartDate && 'Date'[Date] <= _Enddate))

use the above same measure for previous one moth sales calculation just replace -14 with -1 

for current month directly use 
sales = sum[Sales]



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.