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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jpereztang
Helper I
Helper I

Sales of december last year

Hi everyone,

 

i'm getting into trouble and I dont know how to solve. I would like to show the sales of December of last year but according to the period that is being shown as in the image.

 

closed yera.png

 

Measure i want is SalesClosedYear. I hope tou can help me. Thanks

 

 

7 REPLIES 7
tringuyenminh92
Memorable Member
Memorable Member

Hi @jpereztang,

 

In case Period is Whole Number type, you could create calculated measure with expression:

 

SalesClosedYear = 
Var closed = (QUOTIENT(MAX(Sales[Period]),100)-1)*100 + 12
return CALCULATE(SUM(Sales[Sales]),FILTER(ALLSELECTED(Sales[Period]), Sales[Period]=closed ))

1.PNG

 

 

If this works for you please accept it as solution and also like to give KUDOS.

Best regards
Tri Nguyen

 

Ashish_Mathur
Super User
Super User

Hi @jpereztang,

 

Share the link from where i can download your file.


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

Hi @Ashish_Mathur

 

I will send it tomorrow as I quickly did it as part of another Power BI file that I was working on.

 

There should be enough details for you to try it and see if you can get it working?





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

Proud to be a Super User!







Power BI Blog

GilbertQ
Super User
Super User

Hi @jpereztang

 

The first thing that you would need to do is to create a Date Table. This is essential for you to use the Time Intelligence features in Power BI.

 

Here is my blog post on how to create a Date table.

https://www.fourmoo.com/2016/09/13/power-bi-how-to-easily-create-dynamic-date-tabledimension-with-fi...

 

Which you will then create a relationship to your table.

 

Next you would then create a measure in which you would get the value for the previous December. And then within the measure ensure that it repeats across all the Rows.

 

Here are the measures that I created, when I am developing I prefer to have seperate measures which makes troubleshooting and the entire process more granular. But makes sure that it is working as expected.

 

Sales = SUM(Data[Amount])

Sales Dec = CALCULATE([Sales],'Date'[Calendar Month] = "Dec")

Previous Dec Sales = 
CALCULATE (
    [Sales Dec],
         PARALLELPERIOD ( 'Date'[Date], -1, YEAR )
		  )

And here is the result, which is what you indicated with your image below.

 

Email Pic (1).png

 





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

Proud to be a Super User!







Power BI Blog

Hi @GilbertQ I had already created a date table. I want say that  my date table only has one record per month because we take a picture of sales every month close I dont know if it still working as DateTable or is neccesary to have all dates of the year.

 

@GilbertQ I tried your solution and this is the result.

 

result.png

 

PD: I have tabular model connected to excel. Cat Tongue

 

 

Hi @jpereztang,

Have your resolved your problem based on @GilbertQ's solution? And I am confused about sentence " I want say that  my date table only has one record per month because we take a picture of sales every month close I dont know if it still working as DateTable or is neccesary to have all dates of the year."?

And from your first screenshot, there is 2015/12 data, where there is no corresponding in your result(the second screenshot)?

Best Regards,
Angelia

Hi @jpereztang

 

In order for the time intelligence to work it will need dates for every day of each month even if there is no data. This will then ensure that the time intelligence funcation such as PARALLELPERIOD will work as expected.





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

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors