cancel
Showing results for
Did you mean:
Helper III

## Fiscal Calendar - Quarter To Date

I'm having trouble with my Quarter to Date formula not working. I'm trying to make a dynamic QTD formula.

This is what I came up with. I'm guessing if there no sales on the specific date, there are no visible sales.

``````QTD \$ =
VAR CurrentQuarter =
CALCULATE (
MAX (DIM_DATE[fin_quarter_no] ),
DIM_DATE[financial_date] = TODAY ()
)
RETURN
CALCULATE ( [Demand \$], DIM_DATE[fin_quarter_no] = CurrentQuarter ``````

2 REPLIES 2
Super User

@Tuan , If your QTR start with Jan, Apr, Jul, Oct (irrespective of which qtr no they are), You can use datesQTD with date table

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))

Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,Year)))

for any other you need Qtr start date and Qtr Day and Qtr rank column

new columns in date tabke

Qtr Start Date = DATEADD(STARTOFYEAR('Date'[Date],"4/30"),QUOTIENT(DATEDIFF('Date'[Start Of Year], 'Date'[Date],MONTH),3)*3,MONTH) //choose end of year of your choice in place for 4/30
Qtr Day = DATEDIFF('Date'[Qtr Start Date],'Date'[Date],Day)+1
Qtr Rank = RANKX(all('Date'),'Date'[Qtr Start date],,ASC,Dense)

measure like
This Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))
Last Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))

This QTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank]) && [Qtr Day] <=max([Qtr Day])))
Last QTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1 && [Qtr Day] <=max([Qtr Day])))

Creating Financial Calendar - From Any Month
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calend...

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Tutorial Series Dax Vs SQL Direct Query PBI Tips

Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
Helper III

I think i fixed it using <= sign. If anyone has a better method i would love to know.

``DIM_DATE[financial_date] <= TODAY ()``

It works with my Quarter to Date but not my month to date.

Announcements

#### 2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.