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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
greenlover
Frequent Visitor

Count # of days based on month filter

Hello! 

 

Really need your help in counting the number of days based on month selected. I have a date dimension table (DIM_DATE) which has DAY, MONTH, YEAR 

 

And for my FACT table, really need your help in displaying the YTD%. The formula of YTD% is (total actual uptime in hours / number of days based on month selected) 

 

So this is my table: 

 

 ACTUAL UPTIME IN HOURS (YTD ON MONTH)  
SERVICESJanFebMarAprYTD DaysYTD%
Meter Reading                30.69                           59.69                90.69    120.48           120.4899.57%
Disconnection / Reconnection                29.62                           57.92                88.73    118.39           118.3997.84%
 

YTD Days =  Total of ACTUAL UPTIME IN HOURS (YTD ON MONTH)

YTD % = YTD Days/ # of Days based on month selected

 

Thank you! 

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

Hi @greenlover ,

 

Do you want to calculate the cumulative days per month, and use cumulative UPTIME / cumulative days?

If yes, we can create some measures to meet your requirement.

 

1. Create a measure to calculate the cumulative days per month.

 

Cu_count = CALCULATE(COUNT(DIM_DATE[Date]),FILTER(ALLSELECTED(DIM_DATE),DIM_DATE[Date]<MAX(DIM_DATE[Date])))

 

Cou1.jpg

 

2. Create a measure to get the YTD.

 

YTD_Days = CALCULATE(SUM('Table'[uptime]),FILTER(ALLSELECTED(DIM_DATE),DIM_DATE[Date]<MAX(DIM_DATE[Date])))

 

Cou2.jpg

 

3. At last we can get the YTD% using [YTD_Days] / [Cu_count].

 

YTD% = DIVIDE([YTD_Days],[Cu_count])

 

Cou3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data and describe the relations between tables?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

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 @greenlover ,

 

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 @greenlover ,

 

Do you want to calculate the cumulative days per month, and use cumulative UPTIME / cumulative days?

If yes, we can create some measures to meet your requirement.

 

1. Create a measure to calculate the cumulative days per month.

 

Cu_count = CALCULATE(COUNT(DIM_DATE[Date]),FILTER(ALLSELECTED(DIM_DATE),DIM_DATE[Date]<MAX(DIM_DATE[Date])))

 

Cou1.jpg

 

2. Create a measure to get the YTD.

 

YTD_Days = CALCULATE(SUM('Table'[uptime]),FILTER(ALLSELECTED(DIM_DATE),DIM_DATE[Date]<MAX(DIM_DATE[Date])))

 

Cou2.jpg

 

3. At last we can get the YTD% using [YTD_Days] / [Cu_count].

 

YTD% = DIVIDE([YTD_Days],[Cu_count])

 

Cou3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data and describe the relations between tables?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

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.

Vera_33
Resident Rockstar
Resident Rockstar

Hi @greenlover 

 

You want to calculate the cumulative hours against days according to slicer? Please show some raw data structure (randomly generated data is fine), I will have a try then.

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors