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
Tuan
Helper III
Helper III

Calculate Fiscal Sales Last Year with subtotals

I'm trying to calculate last year sales on a Fiscal Calendar from the weeks level up to the quarter level. 

 

I used this code for Previous Year Sales. My problem is that I don't get the Subtotals for Monthly and Quarterly. My calendar itself does have a unique code that gives me year and week such as 20191 for 2019 week 1.

Previous Year Sales = 
VAR CurrentWeek = SELECTEDVALUE( VW_ROSSDW_DIM_DATE[fin_week_in_year] )
VAR CurrentYear = SELECTEDVALUE( VW_ROSSDW_DIM_DATE[fin_year])

RETURN
CALCULATE( [Demand $],
    FILTER( all(VW_ROSSDW_DIM_DATE),
		 VW_ROSSDW_DIM_DATE[fin_week_in_year]= CurrentWeek && VW_ROSSDW_DIM_DATE[fin_year] = CurrentYear - 1))

Sales.PNG

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Tuan 

 

You may take a look at the posts below.

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

That doesn't really solve my problem. I do have a Year/Week column in my date Dimension that says 201901, 201902, etc.

 

Been trying to get this code to work. The minus 100 is to offset the year to 201801, 201802, etc. It not working.

 

VAR CurrentWeek = SELECTEDVALUE( VW_ROSSDW_DIM_DATE[fin_week_in_year] )
VAR CurrentYear = SELECTEDVALUE( VW_ROSSDW_DIM_DATE[fin_year])

RETURN
CALCULATE( [Demand $],
    FILTER( VW_ROSSDW_DIM_DATE,
		 VW_ROSSDW_DIM_DATE[fin_year_week]-100))

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.