cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
reddy421 Frequent Visitor
Frequent Visitor

Sales for last year is not coming up when I Insert a Slicer in Power BI

Hi,

I am trying to find the sales for this year vs last year and this is what I did.

Created 2 new measures:

Total Sales  = SUM(v_FactDailySalesWithLowestPriorityRecord[Net Sales USD])

Total Sales LY   = CALCULATE([Total Sales],SAMEPERIODLASTYEAR(Dim_Date[Calendar_Date]))

 

Till here I was able to succeed in what I want to achieve and below is how it looked like.

2018-06-18 14_42_29-Landrys Employee Payroll - Microsoft Visual Studio.png

Now I thought of adding a filter on Calendar Year and this is what is causing the issue to me.

When I did that and filtered my year to 2016 as shown below, I am not getting the sales for Total Sales LY( Last year sales).

2018-06-18 14_44_13-Landrys Employee Payroll - Microsoft Visual Studio.png

This is even happening to me If I select 2 years like 2015 and 2016 as shown below.

2018-06-18 14_50_28-Landrys Employee Payroll - Microsoft Visual Studio.png

Can someone help me with this?

1 ACCEPTED SOLUTION

Accepted Solutions
Phil_Seamark Super Contributor
Super Contributor

Re: Sales for last year is not coming up when I Insert a Slicer in Power BI

HI @reddy421

 

Please try

 

Total Sales LY   = 
     CALCULATE(
        [Total Sales],
        ALL(Dim_Date) ,
       SAMEPERIODLASTYEAR(Dim_Date[Calendar_Date])
     )

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

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark Super Contributor
Super Contributor

Re: Sales for last year is not coming up when I Insert a Slicer in Power BI

HI @reddy421

 

Please try

 

Total Sales LY   = 
     CALCULATE(
        [Total Sales],
        ALL(Dim_Date) ,
       SAMEPERIODLASTYEAR(Dim_Date[Calendar_Date])
     )

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

Proud to be a Datanaut!

View solution in original post

Highlighted
reddy421 Frequent Visitor
Frequent Visitor

Re: Sales for last year is not coming up when I Insert a Slicer in Power BI

Thanks for the help Phil_seamark.

This worked out now.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 487 members 3,923 guests
Please welcome our newest community members: