cancel
Showing results for
Did you mean:

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

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) SERVICES Jan Feb Mar Apr YTD Days YTD% Meter Reading 30.69 59.69 90.69 120.48 120.48 99.57% Disconnection / Reconnection 29.62 57.92 88.73 118.39 118.39 97.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
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])))``

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])))``

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

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

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.

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.

3 REPLIES 3
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.

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])))``

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])))``

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

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

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.

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.

Resident Rockstar

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.

Announcements

New forum boards available in Real-Time Intelligence.

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

Fabric Monthly Update - May 2024

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

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors