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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Measure to create Sales Amount

This is about to calculate the Sales Amount,

 

Im using a date slicer from date to to date (1-1-2018 to 5-3-2018) and getting the sales amount for this period ,but i could not able to get the sales amount for the same period in the last year (i e.1-1-2017 to 5-3-2017).

 

Simply i need to create a measure to calculate the Sales Amount exactly same period of the last year of the current selection.

 

Can some one help me?

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

You could follow the steps below to get your excepted result.

 

1. You should create a DateTable  and create a relationship between the DateTable and Amounts table.

 

DateTable = CALENDARAUTO()

2.You could create the measure below to get your desired result.

 

lastyear_Amount =
CALCULATE (
    SUM ( Amounts[sales Amount] ),
    SAMEPERIODLASTYEAR ( 'DateTable'[Date] )
)

Then you will get the result below.

 

Capture.PNG

 

For details, you could refer to my test pbix file.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

You could follow the steps below to get your excepted result.

 

1. You should create a DateTable  and create a relationship between the DateTable and Amounts table.

 

DateTable = CALENDARAUTO()

2.You could create the measure below to get your desired result.

 

lastyear_Amount =
CALCULATE (
    SUM ( Amounts[sales Amount] ),
    SAMEPERIODLASTYEAR ( 'DateTable'[Date] )
)

Then you will get the result below.

 

Capture.PNG

 

For details, you could refer to my test pbix file.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-piga-msft,

 

Thank you for the valuable reply.I have already applied the same logic but i got another challenge Power BI does not support the Calendar table in direct query method.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.