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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.