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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.