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
st-dat
Helper III
Helper III

Fiscal Year Sales Measures

 

Hello,

 

I need help to write MEASURES for below, so that I can reuse elsewhere ( I have calendar table and

Fiscal year start April 1 and Ends March 31. I'm using PowerPivot excel 2016.

  • Previous YTD : = ?
  • Previous Fiscal Quarter := ?
  • Month Todate := ?
  • Previous Month Todate := ?
  • Week Todate := ?
  • Previous Week Todate := ?

 

 

>>>>>>I have used below queries and they work well for my need:

>>Fiscal  YTD :=IF([Net Sales]>0,CALCULATE([Net Sales],DATESYTD(dCalendar[Date],"03/31")))

>>Fiscal Quarter :=IF([Net Sales]>0,CALCULATE([Net Sales],DATESQTD(dCalendar[Date])))

 

 

I have tried to use the queries below and some other but all failed to work or displayed blank result:

 

******Error in syntax and did not processed

WTD:=IF (
HASONEVALUE ( DimDate[Year] )
&& HASONEVALUE (DimDate[Working Week] ),
CALCULATE (
SUM (Orders[Unique_Recipients] ),
FILTER (
ALL ( DimDate ),
DimDate[Year] = VALUES ( DimDate[Year] )
&& DimDate[Working Week] = VALUES (DimDate[Working Week])
&& DimDate[Date Value] <= MAX ( DimDate[Date Value])
)
),
BLANK ()
)

 

  • ****Failed and displayed value for the previous year instead of previous Month

 Previous Month := CALCULATE([Net Sales], PREVIOUSMONTH(dCalendar[Date]))

 

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@st-dat,

 

It would be better to share us a simplified example. You may try to apply virtual relationship in DAX.

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.

Hi Sam,

 

Thank you for your response, Kindly use the sample data set below and let me know if you required additional information. Best regards.

 

DateNamePayment
03/05/2017Company-A5.00
03/11/2017Company-B5.00
03/20/2017Company-C5.00
03/08/2017Company-D5.00
04/11/2017Company-E10.00
04/20/2017Company-F20.00
04/08/2017Company-G20.00
04/09/2017Company-H20.00
04/10/2017Company-C10.00
04/11/2017Company-A20.00
04/12/2017Company-B20.00
05/13/2017Company-C5.00
05/14/2017Company-A10.00
05/15/2017Company-B10.00
05/16/2017Company-C50.00
05/17/2017Company-A10.00
  225.00

Hi,

 

Furthermore, I was able get below three to work as expected but unfortunately the rest could not.

 

1) SalesFiscalYear:=IF([TotalSales]>0,CALCULATE([TotalSales],DATESYTD(dCalendar[Date],"03/31")))

2) SalesFiscalQuarter:=IF([Totalsales]>0,CALCULATE([TotalSales],DATESQTD(dCalendar[Date])))

3) SalesPrevQuarter:=CALCULATE([TotalSales],DATEADD(dCalendar[Date],-1,QUARTER))

 

When I modified the above queries to achieve the following: (1)Prev Year, (2)Month, (3)Prev Month, (4)Week, and (5) Prev Week. The result was 'blanks' or high value far above expected value or an error message like "

Semantic error: A column specified in the call to function DATEADD is not type of Date. This is not supported."

 

Thank you for your help.

 

St-dat

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.