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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

How to find amount of days between quarters & amount of days between end of quarter and today?

Hi there!

 

I'm trying to find out two separate values:

 

1. The amount of days in a quarter. I am using a 'source_data_view'[date] field, although in my report it I only have two filters: Quarter and Fiscal Year (single select).

 

So, if I choose Q1 2020, then the date range will be between 10/1/2019 and 12/31/2019, and it will return 91 days.

 

2. The amount of days between the last of the selected quarter minus today.

 

So, if I choose Q1 2020, then it will show the last day of the quarter minus today.

 

Meaning, the last day of Q1 2020, 12/31/2019 minus today, 3/10/2021, would return -435 days.

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Try the following formula:

QuarterDay = 
DATEDIFF(
    MINX(
        ALLSELECTED(source_data_view),
        source_data_view[Date]
    ),
    MAXX(
        ALLSELECTED(source_data_view),
        source_data_view[Date]
    ),
    DAY
)
Q_End_Today = 
-DATEDIFF(
    MAXX(
        ALLSELECTED(source_data_view),
        source_data_view[Date]
    ),
    TODAY(),
    DAY
)

image.png

This is my PBIX file.

https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-lazhang_microsoft_com/EVaSs5EZpcFBrhNv90zQHuYB_QXpGmFmeHNdNLCr7IkVeg?e=QDEZAK

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Not very  clear

Assume the qtr coming from a date table

Measure =

var _min = minx(allselected(Date), Date[Date])

var _max = today()

return

datediff(_min ,_max, day)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Thanks, @amitchandak,

 

However, when I create a measure for the var_min, when I try to enter DATE['source_data_view'[Date], it gives me an error with the red underline.

Hi @Anonymous ,

Try the following formula:

QuarterDay = 
DATEDIFF(
    MINX(
        ALLSELECTED(source_data_view),
        source_data_view[Date]
    ),
    MAXX(
        ALLSELECTED(source_data_view),
        source_data_view[Date]
    ),
    DAY
)
Q_End_Today = 
-DATEDIFF(
    MAXX(
        ALLSELECTED(source_data_view),
        source_data_view[Date]
    ),
    TODAY(),
    DAY
)

image.png

This is my PBIX file.

https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-lazhang_microsoft_com/EVaSs5EZpcFBrhNv90zQHuYB_QXpGmFmeHNdNLCr7IkVeg?e=QDEZAK

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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!

December 2024

A Year in Review - December 2024

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