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

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.