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
ligalbert
Helper I
Helper I

How can I create a measure that adds all orders done in 1 year exactly

I want to add all orders done by the customer exactly 1 year after first order. For example customerID 1000 first order was march 3 2006. I want to add all orders done up to march 3 2007. 

Capture.PNG

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @ligalbert 

You can refer to the following measure

Measure = var a=CALCULATE(FIRSTNONBLANK('Table'[OrderDate],0),'Table'[CustomerID]=SELECTEDVALUE('Table'[CustomerID]),REMOVEFILTERS('Table'))
return CALCULATE(SUM('Table'[Orders Order]),'Table'[OrderDate]>=a&&'Table'[OrderDate]<=EOMONTH(a,12)-(DAY(EOMONTH(a,0))-DAY(a)))

vxinruzhumsft_1-1679277676164.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @ligalbert 

You can refer to the following measure

Measure = var a=CALCULATE(FIRSTNONBLANK('Table'[OrderDate],0),'Table'[CustomerID]=SELECTEDVALUE('Table'[CustomerID]),REMOVEFILTERS('Table'))
return CALCULATE(SUM('Table'[Orders Order]),'Table'[OrderDate]>=a&&'Table'[OrderDate]<=EOMONTH(a,12)-(DAY(EOMONTH(a,0))-DAY(a)))

vxinruzhumsft_1-1679277676164.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.