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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ovanslyke
Frequent Visitor

% Percentage of Quarter that has elapsed

Hi! I am able to get the percentage of the year that has elapsed with this Measure calculation:

 

Year Frac = YEARFRAC(DATE(YEAR(Data[Today]),1,1),Data[Today])

 

For today the result is 45.6%

 

What I want to do now is show the % of the quarter that has elapsed. Our Q1  is Jan-Mar etc.

 

How would I do this?

 

Ideally I would also have a slicer for the quarters and I would expect the see Q1 at 100% complete, and Q2 as 90% complete etc.

 

Thanks for your help!

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @ovanslyke,

 

In that case, you need a date table which contains a date column. Based on this date column, you should generate a quarter number column.  Also, there should be a separate table containing a column that shows a list of Quarter number which will be added into a slicer later.

Date table =CALENDAR ( DATE ( 2016, 1, 1 ), DATE ( 2017, 12, 31 ) )

Quarter Number = 'Date table'[Date].[QuarterNo]

1.PNG2.PNG

 

Then, please create measures like below:

Totday date = TODAY() 

Current Quarter = ROUNDUP(MONTH(TODAY())/3, 0)

Max date in selected quarter =
CALCULATE (
    MAX ( 'Date table'[Date] ),
    FILTER (
        'Date table',
        'Date table'[Date].[Year] = YEAR ( TODAY () )
            && 'Date table'[Quarter Number] = MAX ( Quarter[Quarter Number] )
    )
)

Count days for quarter =
CALCULATE (
    COUNT ( 'Date table'[Date] ),
    FILTER (
        'Date table',
        'Date table'[Date].[Year] = YEAR ( TODAY () )
            && 'Date table'[Quarter Number] = MAX ( Quarter[Quarter Number] )
    )
)

Date diff =
IF (
    [Totday date] >= [Max date in selected quarter],
    1,
    IF (
        [Current Quarter] < MAX ( Quarter[Quarter Number] ),
        0,
        1
            - (
                DATEDIFF ( [Totday date], [Max date in selected quarter], DAY )
                    / [Count days for quarter]
            )
    )
)

4.PNG

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @ovanslyke,

 

Have you worked it out now? If so, please kindly mark the corresponding reply as an answer so that it can benefit more pelple. If you still have any question, please feel free to ask.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yulgu-msft
Employee
Employee

Hi @ovanslyke,

 

In that case, you need a date table which contains a date column. Based on this date column, you should generate a quarter number column.  Also, there should be a separate table containing a column that shows a list of Quarter number which will be added into a slicer later.

Date table =CALENDAR ( DATE ( 2016, 1, 1 ), DATE ( 2017, 12, 31 ) )

Quarter Number = 'Date table'[Date].[QuarterNo]

1.PNG2.PNG

 

Then, please create measures like below:

Totday date = TODAY() 

Current Quarter = ROUNDUP(MONTH(TODAY())/3, 0)

Max date in selected quarter =
CALCULATE (
    MAX ( 'Date table'[Date] ),
    FILTER (
        'Date table',
        'Date table'[Date].[Year] = YEAR ( TODAY () )
            && 'Date table'[Quarter Number] = MAX ( Quarter[Quarter Number] )
    )
)

Count days for quarter =
CALCULATE (
    COUNT ( 'Date table'[Date] ),
    FILTER (
        'Date table',
        'Date table'[Date].[Year] = YEAR ( TODAY () )
            && 'Date table'[Quarter Number] = MAX ( Quarter[Quarter Number] )
    )
)

Date diff =
IF (
    [Totday date] >= [Max date in selected quarter],
    1,
    IF (
        [Current Quarter] < MAX ( Quarter[Quarter Number] ),
        0,
        1
            - (
                DATEDIFF ( [Totday date], [Max date in selected quarter], DAY )
                    / [Count days for quarter]
            )
    )
)

4.PNG

Best regards,
Yuliana Gu

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.