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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
sdionne
Frequent Visitor

Compare sales

Hi, in one table I have all sales, I can compare sales from selected year and previous year, my problem is with actual year, I want to summerize previous year sales only to the same date as today but last year:

In this example I want sales last year until november, and when I will have december sales, I wants only too last year december sales.

 

Capture.JPG

Thanks

sdionne

1 ACCEPTED SOLUTION

Hi,

 

Try this

 

=IF(ISBLANK(Ventes[Ventes]),BLANK(),CALCULATE(Ventes[Ventes];DATESYTD(Calendrier[Date];"30/09"))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Phil_Seamark
Employee
Employee

Hi @sdionne

 

What formula are you using for your measures?

 

I had some success with the following:

 

Ventes Total YTD = TOTALYTD(SUM('Sales'[Ventes]),'Dates'[Date])

Ventes Total Annee Pre YTD = TOTALYTD(SUM('Sales'[Ventes]),SAMEPERIODLASTYEAR('Dates'[Date]))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi Phil, I tested yoyr formulas and it's not working for me.

My formulas are:

Ventes Total YTD = CALCULATE(Ventes[Ventes];DATESYTD(Calendrier[Date];"30/09"))

Ventes Total Année Précédente YTD = CALCULATE(Ventes[Ventes Année Précédente];DATESYTD(Calendrier[Date];"30/09"))

 

Please note I calculate according to fiscal year from oct. to sept.

 

Thanks

Sylvain

 

 

Hi,

 

You are missing the SUM function.  Try this

 

=CALCULATE(SUM(Ventes[Ventes]);DATESYTD(Calendrier[Date];"30/09"))

 

Also, ensure that in your visual, you draf Year/months/days from the Calendar table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, it was not clear but Ventes[Ventes] is measure and is already a sum.

And the Date is in the view

Again this is what I have:

 

Capture2.JPG

And what I want:

Capture3.JPG

 

Thanks

Sylvain

 

Hi @sdionne,

 

Please make sure that you dragged [Date] field from calendar table, rather than your source table 'Ventes'.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Try this

 

=IF(ISBLANK(Ventes[Ventes]),BLANK(),CALCULATE(Ventes[Ventes];DATESYTD(Calendrier[Date];"30/09"))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks!

Sylvain

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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