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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
flippe
Regular Visitor

Compare last 3months with last 6m

Hi all,

 

Here's my sample:

 

flippe_0-1669733959978.png

I need to sum up the last 3 month views (green rows) and compare it against the last 6 months views (from August to June - yellow rows).

At the moment, the sum of 3 months views is working properly:

 

Previous 3M views =
CALCULATE(
    [Total Views],
    DATESINPERIOD(
        Calendar[Date],EOMONTH(TODAY(),-1),-6,MONTH)
        )
 
How can I accomplish the sum of the yellow rows?
1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi, @flippe 

According to your description, you want to calculate “the last 6 months views”. Right?

Here are the steps you can refer to:

(1)This is my test data:

vyueyunzhmsft_0-1669772878654.png

(2)I create a date table like yours and create relationships between two tables:

vyueyunzhmsft_1-1669772905232.png

(3)Then we can create a measure :

Previous 6M views = var _current_date =EOMONTH( MAX('Calendar'[Date]) , 0)
var _previous_months = EOMONTH(_current_date,-6)+1
var _t= FILTER( ALLSELECTED('Table') , 'Table'[Date] >= _previous_months  && 'Table'[Date] <= _current_date)
return
SUMX(_t ,[Value])

(4)Then we can put this on the visual and we will meet your need:

vyueyunzhmsft_2-1669772957313.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Hi, @flippe 

According to your description, you want to calculate “the last 6 months views”. Right?

Here are the steps you can refer to:

(1)This is my test data:

vyueyunzhmsft_0-1669772878654.png

(2)I create a date table like yours and create relationships between two tables:

vyueyunzhmsft_1-1669772905232.png

(3)Then we can create a measure :

Previous 6M views = var _current_date =EOMONTH( MAX('Calendar'[Date]) , 0)
var _previous_months = EOMONTH(_current_date,-6)+1
var _t= FILTER( ALLSELECTED('Table') , 'Table'[Date] >= _previous_months  && 'Table'[Date] <= _current_date)
return
SUMX(_t ,[Value])

(4)Then we can put this on the visual and we will meet your need:

vyueyunzhmsft_2-1669772957313.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.