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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
zx00289
New Member

Calculate quarter-to-date values with starting month from February in Dax

Hi,

 

I have a set of data that would like to calculate the demand in quater-to-date.

zx00289_0-1665018846064.png

My financial year starts from February hence my quarter-to-date value for Q1 would be 26591+39276+24091=89958, Q2 would be 97159 and etc. 

 

I have created a data table as below:

Date =
VAR FirstDayOfWeek = 0 -- 0 = Sunday, 1 = Monday, ...
RETURN
GENERATE (
CALENDARAUTO (),
VAR Yr =
YEAR ( [Date] ) -- Year Number
VAR Mn =
MONTH ( [Date] ) -- Month Number (1-12)
VAR Qr =
QUARTER ( [Date] ) -- Quarter Number (1-4)
VAR MnQ = Mn - 3 * ( Qr - 1 ) -- Month in Quarter (1-3)
VAR Wd =
WEEKDAY ( [Date], 1 ) - 1 -- Weekday Number (0 = Sunday, 1 = Monday, ...)
RETURN
ROW (
"Year", DATE ( Yr, 12, 31 ),
"Year Quarter", FORMAT ( [Date], "\QQ-YYYY" ),
"Year Quarter Date", EOMONTH ( [Date], 3 - MnQ ),
"Quarter", FORMAT ( [Date], "\QQ" ),
"Year Month", EOMONTH ( [Date], 0 ),
"Month", DATE ( 2000, MONTH ( [Date] ), 1 ),
"Fiscal Month No",
IF ( MONTH ( [Date] ) >= 2, MONTH ( [Date] ) - 1, MONTH ( [Date] ) + 11 ),
"Fiscal Quarter",
"Q" & IF (MONTH( [Date] ) = 1, QUARTER( [Date]) + 3 , IF(MONTH([Date]) IN {4, 7, 10}, QUARTER([Date])-1, QUARTER([Date]))),
"Fiscal Year",
IF ( MONTH ( [Date] ) >= 2, DATE ( ( Yr + 1 ), 12, 31 ), DATE ( Yr, 12, 31 ) )
)
)
 
How should I get the demand value in quater-to-date using Dax?
 
Thanks.
 
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @zx00289 ,

I created a sample pbix file(see the attachment), please check if that is what you want.

yingyinr_1-1665122776948.png

yingyinr_0-1665122745454.png

Best Regards

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

View solution in original post

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @zx00289 ,

I created a sample pbix file(see the attachment), please check if that is what you want.

yingyinr_1-1665122776948.png

yingyinr_0-1665122745454.png

Best Regards

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.