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
Anonymous
Not applicable

Calculate sales of product the first 12 months

Hi Everyone, 

 

I am trying to create a measure that calculate the first 12 month of a product sales and when it's more than 12 months, the measure will not calculate the product sales anymore. 

I have two tables sales and dimdate.

I would like to use the launch date to create the measure something that i am not doing right now. 

This is my measure :  

sales =
VAR LaunchMonthNo =
MIN ( 'dimdate'[MonthOverYears] )
VAR TargetMonthNo = LaunchMonthNo + 11
RETURN
CALCULATE (
SUM ( Sales[Amount] ),
FILTER (
'Sales',
Sales[Date] >= MIN ( NPD[Launch Date] )
&& Sales[Date]
<= MAXX (
FILTER ( ALL ( 'dimdate' ), 'dimdate'[MonthOverYears] = TargetMonthNo ),
'dimdate'[date]
)
)
 
 
Thank you in advance
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , try something like this

 

CALCULATE (
SUM ( Sales[Amount] ),
FILTER (
'Sales',
Sales[Date] >= MIN ( NPD[Launch Date] )
&& Sales[Date]
<= eomonth(MAX ( NPD[Launch Date] ),12)
))

 

or

 

CALCULATE (
SUM ( Sales[Amount] ),
FILTER (
'Sales',
Sales[Date] >= MIN ( NPD[Launch Date] )
&& Sales[Date]
<= MAX ( NPD[Launch Date] ) +365
))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , try something like this

 

CALCULATE (
SUM ( Sales[Amount] ),
FILTER (
'Sales',
Sales[Date] >= MIN ( NPD[Launch Date] )
&& Sales[Date]
<= eomonth(MAX ( NPD[Launch Date] ),12)
))

 

or

 

CALCULATE (
SUM ( Sales[Amount] ),
FILTER (
'Sales',
Sales[Date] >= MIN ( NPD[Launch Date] )
&& Sales[Date]
<= MAX ( NPD[Launch Date] ) +365
))

Anonymous
Not applicable

Hi  

 

 

 

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.