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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
st-dat
Helper III
Helper III

Help to Calculate Previous and Current Fiscal Periods

Hello there,

 

I have my sales table related to Calendar table but

I need help to Calculate the TOTAL SALES during the period below: 

 

1) Last Week

2) Current Week To Date

3) Last Fiscal Month

4) Current Month To Date

5) Last Fiscal Quarter

6) Current Fiscal Quarter todate

7) Last Fiscal Year

😎 Current Fiscal Year To date

 

Thanks for your usual help

1 ACCEPTED SOLUTION

Hi,

 

You may download my PBI file from here.  This will get your started.

 

Hope this helps.


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

View solution in original post

15 REPLIES 15
Ashish_Mathur
Super User
Super User

Hi,

 

  1. Share some data to work with
  2. What is your Fiscal Year
  3. How would you define weeks?

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

Hi,

 

Thanks for your response,

 

1) You could please use any test data available you, reason because I have no access to copy the fact table because I'm a volunteer.

2) The Fiscal year starts April 1, and ends March 31.

3) Sunday is the first day of the week and Saturday is the last day.

 

Best Regards

 

Hi,

 

Let me know if I have been able to provide you required information to help solve my issue.

Your response will be highly appreciated.

 

Best Regards

Hi,

 

As requested, please share some data.  I do not want to create any dataset of my own.


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

Hi Ashish,

 

I hope this sample dataset would be useful..

Calculate customer Net payment during the period listed: WTD, PrevW, MTD, PrevMonth, FiscalQTD, PrevFiscalQ, FYTD, and PrevFiscalYr

 

Many thanks

 

Invoice NumberCustomer IDTrans DateNet Value
9992586Customer 381312/14/2015 $      3,091.00
9992587Customer 381412/21/2015 $      3,090.00
9992798Customer 402511/02/2015 $      2,813.00
9992799Customer 402611/09/2015 $      2,812.00
9992800Customer 402710/30/2015 $      2,811.00
9992801Customer 402810/23/2015 $      2,810.00
88917Customer 427209/01/2015 $      2,451.00
88915Customer 427309/08/2015 $      2,449.00
88912Customer 427408/31/2015 $      2,446.00
88911Customer 427508/24/2015 $      2,445.00
85519Customer 444107/02/2015 $      2,132.00
85520Customer 444207/09/2015 $      2,131.00
85572Customer 449406/01/2015 $      1,976.00
85573Customer 449506/08/2015 $      1,975.00
85574Customer 449605/22/2015 $      1,973.00
85575Customer 449705/29/2015 $      1,972.00
85576Customer 449805/29/2015 $      1,971.00
89734Customer 460903/02/2015 $      1,514.00
89733Customer 461003/10/2015 $      1,513.00
89730Customer 461102/27/2015 $      1,510.00
89724Customer 461202/26/2015 $      1,504.00
89716Customer 461302/24/2015 $      1,497.00
84415Customer 468801/05/2015 $      1,198.00
84414Customer 468901/05/2015 $      1,197.00
84391Customer 470012/16/2014 $      1,124.00
84389Customer 470112/15/2014 $      1,122.00
84387Customer 470212/01/2014 $      1,082.00
84385Customer 470311/19/2014 $      1,040.00
84383Customer 470411/10/2014 $      1,003.00
84381Customer 470511/07/2014 $          995.00
84379Customer 470610/27/2014 $          957.00
84377Customer 470710/07/2014 $          886.00
84375Customer 470810/01/2014 $          857.00
84373Customer 470909/22/2014 $          830.00
84371Customer 471009/15/2014 $          803.00
84369Customer 471108/29/2014 $          758.00
84367Customer 471208/07/2014 $          683.00
84365Customer 471308/05/2014 $          672.00
84363Customer 471407/17/2014 $          627.00
84361Customer 471507/09/2014 $          597.00
84359Customer 471606/18/2014 $          483.00
84357Customer 471706/05/2014 $          434.00
84355Customer 471804/08/2014 $          340.00
84353Customer 471904/08/2014 $          339.00
84293Customer 474903/05/2014 $          230.00
84291Customer 475003/04/2014 $          225.00
84289Customer 475103/04/2014 $          224.00
84269Customer 476102/15/2014 $          156.00
84259Customer 476602/07/2014 $          138.00
84257Customer 476702/05/2014 $          135.00
84255Customer 476801/22/2014 $          127.00
84253Customer 476901/29/2014 $          123.00

 

 

Hi,

 

You may download my PBI file from here.  This will get your started.

 

Hope this helps.


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

Hello,

 

Just to share an update for more help. 

I tried the queries below and they seems working, but need help to get other right such as: CurrMonth; Curr Fiscal Quarter; Prev Fiscal Quarter; Prev Fiscal Year (My Fiscal year starts in April 1st and ends in March 31)

 

CurWk:=CALCULATE([NetValue],ALL(dCalendar),FILTER(ALL(dCalendar),dCalendar[DayOfWeekNo]=MAX(dCalendar[DayOfWeekNo])-0),VALUES(dCalendar[DayOfWeek]))

 

PrevWk:=CALCULATE([Netvalue],ALL(dCalendar),FILTER(ALL(dCalendar),dCalendar[DayOfWeekNo]=MAX(dCalendar[DayOfWeekNo])-1),VALUES(dCalendar[DayOfWeek]))

 

PrevMonth:=CALCULATE([Netvalue],DATEADD(dCalendar[Date],-1,MONTH))

 

FiscalYr:=IF([Netvalue]>0,CALCULATE(me2nOffContract[%onContract],DATESYTD(dCalendar[Date],"03/31/2014")))

 

Thank you

Hi,

 

The measures will will depend upon what you select in the slicer - will you select a month, quarter, year?


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

Hi Ashish,

 

Tested and works excellently. Thank so much.

 

My second related humble request, a need for measures to calculate Fiscal Year, PrevFiscalYear, Fiscal Quarter, PrevFiscalQuarter , MTD, PrevMTD. My Fiscal Year start: April 1st and End: March 30th.

 

I hope measures can be reuse by modifying to suit other purpose.

 

Thank you for your usual support.

 

st-dat

 

 

 

 

Hello,

 

Thanks for your message, please expect a sample dataset in 15 mins. Regards

 

St-dat

Anonymous
Not applicable

DAX has a lot of inbuilt functions to handle some of your calculations. 

1/2)  Week Number: https://msdn.microsoft.com/en-us/query-bi/dax/weeknum-function-dax

DAX  makes working with weeks very complex so acheiving 1) and 2) will be tricky.This has already been solved here: https://community.powerbi.com/t5/Desktop/Calculating-Month-To-Date-and-Week-to-Date/m-p/67869#M28106


3) PreviousMonth: https://msdn.microsoft.com/en-us/query-bi/dax/previousmonth-function-dax
4) Month To Date: https://msdn.microsoft.com/en-us/query-bi/dax/totalmtd-function-dax

5) PreviousQuarter: https://msdn.microsoft.com/en-us/query-bi/dax/previousquarter-function-dax
6) Quarter To Date: https://msdn.microsoft.com/en-us/query-bi/dax/totalqtd-function-dax

7) PreviousYear: https://msdn.microsoft.com/en-us/query-bi/dax/previousyear-function-dax 
😎 Year To Date: https://msdn.microsoft.com/en-us/query-bi/dax/totalytd-function-dax

Hope this helps - reach out if you have any more questions or require further help!

Thanks for your effort and reponse. Do or any forum members have any help on measures to sCalculate FISCAL PERIOD such as:

 

3) Last Fiscal Month

4) Current Fiscal Month To Date

5) Last Fiscal Quarter

6) Current Fiscal Quarter todate

7) Last Fiscal Year

😎 Current Fiscal Year To date

 

Anonymous
Not applicable

Do you have a column in your data set that idenitfiys the Fiscal Year? If you do you can do sometihng like this:

CurrentFiscalYear =

VAR

               CFiscalYear =

                              LOOKUPVALUE(

                                             'Date'[Fiscal Year]

                                             ,'Date'[Date]

                                             ,TODAY()

                              )

return 1 * ('Date'[Fiscal Year]= CFiscalYear)

For previous :

PreviousFiscalYear =

VAR

              PFiscalYear=

                              LOOKUPVALUE(

                                             'Date'[Fiscal Year]

                                             ,'Date'[Date]

                                             ,TODAY()

                              )

return 1 * (DATEADD('Date'[Fiscal Year],1,YEAR) = PFiscalYear)

No thanks, I have no column as such that identify the fiscal year.

 

Thank you

Thank you, I will work with your recommendations and provide feedback later.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.