cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
sarjensystems1
Helper III
Helper III

Last year to date sales

Hii..

I have a requirement to calculate last year sales i.e if today date is 19/oct/2019 i need the last year sales from 01/Jan/2018 to 19/Oct/2018

I have used

SAMEPERIODLASTYEAR,
PARALLELPERIOD,dateadd functions but all the functions is not satisfying my requirement....
all the functions are returning the sales from 01/Jan/2018 and 31/Oct/2018
is there any way to do this??
 
Thanks
1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @sarjensystems1 

It would certainly help if you show a sample of your tables. Assuming you are looking for a measure, try this in a card visual:

 

Measure =
VAR First_ =
    DATE ( YEAR ( TODAY () ) - 1; 1; 1 )
VAR Last_ =
    EDATE ( TODAY (); -12 )
RETURN
    CALCULATE (
        SUM ( Table1[Sales] );
        Table1[Date] >= First_;
        Table1[Date] <= Last_
    )

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

1 REPLY 1
AlB
Super User
Super User

Hi @sarjensystems1 

It would certainly help if you show a sample of your tables. Assuming you are looking for a measure, try this in a card visual:

 

Measure =
VAR First_ =
    DATE ( YEAR ( TODAY () ) - 1; 1; 1 )
VAR Last_ =
    EDATE ( TODAY (); -12 )
RETURN
    CALCULATE (
        SUM ( Table1[Sales] );
        Table1[Date] >= First_;
        Table1[Date] <= Last_
    )

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors