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
Anonymous
Not applicable

Current Year Sales

Hello all,
 
I am currently stuck with calculating the sales of current year Sales.
So the goal is to show a line graphic that shows sales data from 1 januari of 2019 until 9 januari 2019. On this Power BI report page a user must not filter any visuals..
 
My current measure Current Year Sales is as below:
 
Current Year Sales = CALCULATE(SUM('Sales invoice line'[Line amount MST]);
YEAR('Dim Calender Sales Invoice'[FullDateAlternateKey])=YEAR(TODAY()))
 
 
Any suggestions?
 
Thank you 
1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered to close this topic?

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

6 REPLIES 6
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered to close this topic?

 

Regards,

Daniel He

Community Support Team _ Daniel He
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 @Anonymous,

 

You can create a calculate column in 'Dim Calender Sales Invoice' :

IsCurrentYear =
VAR TodayDate =
    TODAY ()
VAR CurrentYear =
    YEAR ( TodayDate )
RETURN
    'Dim Calender Sales Invoice'[FullDateAlternateKey]
    >= DATE ( CurrentYear, 01, 01 )

Then the following measure:

Current Year Sales =
VAR Temp =
    CALCULATE (
        SUM ( 'Sales invoice line'[Line amount MST] ),
        'Dim Calender Sales Invoice'[IsCurrentYear] = TRUE ()
    )
RETURN
    IF ( Temp = BLANK (), 0, Temp )

 Best Regards

Chiara

 

affan
Solution Sage
Solution Sage

hi @Anonymous

 

Can you please elaborate a little more what you are trying to acheive. As per your post above, the measure is correct and shows the current year sales only.

 

So what is the probelm?

 

Thanks & Regards

Affan

Anonymous
Not applicable

Hi @affan,

The measure is correct indeed. but the when i display this on a table

 

The result is now

 

date 

 

Anonymous
Not applicable

Year               Sales
2016        560.000
2017        560.000

2018        560.000

2019        560.000

 

I expect the following table result

 

Year           Sales
2016        0
2017        0

2018        0

2019        560.000

 

 

So how can i get this result based on my current measure of Current Year Sales

 

Current Year Sales = CALCULATE(
SUM('Sales invoice line'[Line amount MST]);
YEAR('Dim Calender Sales Invoice'[FullDateAlternateKey])=YEAR(TODAY()))
 

Hi @Anonymous,

Based on my test, this measure could work on my side:

1.PNG

Could you please offer your data to have a test? Also you could download my pbix file to have a view.

 

Regards,

Daniel He

 

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

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.