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

Calculating Sum for a Column by a Set Time Period from the Past

Hello, 

  I am attempting to create a bar chart with 12 columns for each month of the year. Each column will represent 6 months of data starting from each month. (ex. January will represent a 6 month outlook until June, February will show until July, etc.) I have the data in seperate columns for each month, but they are not filtered by the time period of six months (from the beginning of that month), instead, each column for each month has data for 2+ years, not the six month periods I'm looking for. 

 

I used the code below, but it is still not working for me. Any suggetions would be appreciated!

 

Thanks!

 

Jan6Months = CALCULATE(SUM(Pipeline_Outlook[January 2018]),FILTER(Pipeline_Outlook, Pipeline_Outlook[Close Date] = DATEADD(Pipeline_Outlook[Close Date],6, MONTH) ))

 

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

@Anonymous,

 

Modify your measure like pattern below and check if it can meet your requirement:

 

Jan6Months =
VAR selected_month =
SELECTEDVALUE ( Pipeline_Outlook[Close Date] )
RETURN
CALCULATE (
SUM ( Pipeline_Outlook[January 2018] ),
FILTER (
Pipeline_Outlook,
MONTH ( Pipeline_Outlook[Close Date] ) >= selected_month
&& Pipeline_Outlook
< selected_month + 6
)
)

Community Support Team _ Jimmy Tao

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-yuta-msft
Community Support
Community Support

@Anonymous,

 

Modify your measure like pattern below and check if it can meet your requirement:

 

Jan6Months =
VAR selected_month =
SELECTEDVALUE ( Pipeline_Outlook[Close Date] )
RETURN
CALCULATE (
SUM ( Pipeline_Outlook[January 2018] ),
FILTER (
Pipeline_Outlook,
MONTH ( Pipeline_Outlook[Close Date] ) >= selected_month
&& Pipeline_Outlook
< selected_month + 6
)
)

Community Support Team _ Jimmy Tao

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.