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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
johna123
Frequent Visitor

Measure for % of month/quarter/year elapsed

Hi - I'm trying to create a measure which calculates the % of days elapsed for each month/quarter/year. I was able to create a measure which shows the % of time elapsed for the current month but need this to calculate the % for each month seperately and also roll up to the quarter and year. 

 

See below for the visual:

johna123_0-1605539467028.png

The measure I used: 

 

percentage of completion of the month =
CALCULATE (
DIVIDE ( DAY ( TODAY () ), DAY ( LASTDATE ( DimTime[Date] ) ), 0 ),
FILTER (
ALL ( DimTime[Date] ),
YEAR ( DimTime[Date]) = YEAR ( TODAY () )
&& MONTH ( DimTime[Date] ) = MONTH ( TODAY () )))

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @johna123 ,

 

Do you want to show the result of measure or measure 2?

 

Mea1.jpg

 

Measure = 
var _month = CALCULATE(DISTINCTCOUNT(DimDate[Date]),FILTER(DimDate,DimDate[Date]<=TODAY()))
var _Quarter = CALCULATE(DISTINCTCOUNT(DimDate[Date]),FILTER(ALLSELECTED(DimDate),DimDate[Year-Quarter]=MAX(DimDate[Year-Quarter])))
var _each = 
IF(
    ISINSCOPE(DimDate[month]),_month,_Quarter)
return
DIVIDE(_each,_Quarter)

 

Measure 2 = 
var _month = CALCULATE(DISTINCTCOUNT(DimDate[Date]),FILTER(DimDate,DimDate[Date]<=TODAY()))
var _Quarter = DISTINCTCOUNT(DimDate[Date])
return
DIVIDE(_month,_Quarter)

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

3 REPLIES 3
v-zhenbw-msft
Community Support
Community Support

Hi @johna123 ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution.

If the above posts help, please kindly mark it as a solution to help others find it more quickly.

 

Best regards,

 

Community Support Team _ zhenbw

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

v-zhenbw-msft
Community Support
Community Support

Hi @johna123 ,

 

Do you want to show the result of measure or measure 2?

 

Mea1.jpg

 

Measure = 
var _month = CALCULATE(DISTINCTCOUNT(DimDate[Date]),FILTER(DimDate,DimDate[Date]<=TODAY()))
var _Quarter = CALCULATE(DISTINCTCOUNT(DimDate[Date]),FILTER(ALLSELECTED(DimDate),DimDate[Year-Quarter]=MAX(DimDate[Year-Quarter])))
var _each = 
IF(
    ISINSCOPE(DimDate[month]),_month,_Quarter)
return
DIVIDE(_each,_Quarter)

 

Measure 2 = 
var _month = CALCULATE(DISTINCTCOUNT(DimDate[Date]),FILTER(DimDate,DimDate[Date]<=TODAY()))
var _Quarter = DISTINCTCOUNT(DimDate[Date])
return
DIVIDE(_month,_Quarter)

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

amitchandak
Super User
Super User

@johna123 , Not very clear. Try a measure like

 

divide(calculate( count(Date[Date]), Date[Date]<=today()),count(Date[Date]))

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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