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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Data Grouping

I've got an Excel spreadsheet with Dates and values associated with each dates,

I'm trying to make a graph that can compare the sum of the values from June 21st 2018 to June 21st 2019 to the sum of the values between June 21st 2019 to June 21st 2020.

 

Is it possible ?

 

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I'm not sure what your table structure looks like and what kind of output visual you want.

I'd like to suggest you to create some Meaures as below.

sum2019 = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[date]>=DATE(2018,6,21)&&'Table'[date]<DATE(2019,6,21)))
sum2020 = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[date]>=DATE(2019,6,21)&&'Table'[date]<DATE(2020,6,21)))

 Result would be shown as below.

1.PNG

If i misunderstood your meaning, please share some sample data and expected result to us if you don't have any Confidential Information.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

3 REPLIES 3
GanzorigBatbold
Frequent Visitor

A more dynamic (future-proof) solution would be adding a custom column on the table that contains your dates. Lets assume the name of that table is 'table' and the column that contains dates is 'date'. Then the DAX should look something like this:

 

=if(month('table'[date])<6,year(date),if(month('table'[date])=6 && day('table'[date])<21,year(date),year(date)+1))

 

Then you can use this column to filter your data. Should give the categorisation you desire.

 

 

Anonymous
Not applicable

Hi @Anonymous ,

 

I'm not sure what your table structure looks like and what kind of output visual you want.

I'd like to suggest you to create some Meaures as below.

sum2019 = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[date]>=DATE(2018,6,21)&&'Table'[date]<DATE(2019,6,21)))
sum2020 = CALCULATE(SUM('Table'[value]),FILTER('Table','Table'[date]>=DATE(2019,6,21)&&'Table'[date]<DATE(2020,6,21)))

 Result would be shown as below.

1.PNG

If i misunderstood your meaning, please share some sample data and expected result to us if you don't have any Confidential Information.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

GilbertQ
Super User
Super User

Hi there

This would be possible, what you would need to do is to create a measure using the SAMEPERIODLASTYEAR

Or you would need to define a period in your date table for the values you want to compare?

If you have some sample data, that would assist people in giving you the solution.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors