Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
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!
Solved! Go to Solution.
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.
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.
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.
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.
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.
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.