Forum Discussion
To Stop Measure Calculation for Future Months
Context:
I have a measure that calculates uptime based on downtime. I wanted to show 100% of uptime for the days an application may not have downtime and created the % Uptime measure. However, for future months where there will be blanks based on the measure, I am seeing a 100%.
Question: How can I exclude the measure from doing the calculation to the future months? For example if it is run in September, I should not expect to see Oct-Dec.
- Anonymous2 years ago
I actually found a solution. I created a Date table and joined to my Fact Table. I use the date from the Date table in the visual on the xaxis and use the logic above when calculating uptime.
I created a flag column in the date table to check if the date is before today (since I won't have data past today from my fact table). I use the flag in the filter panel.
4 Replies
- AnonymousNot applicable
Hi Anonymous ,
Please update the formula of measure [% Uptime] as below and check if it can return the expected result...
% Uptime = VAR _uptime = 'Problem'[Total Time YTD] - 'Problem'[Downtime (Mins) YTD] VAR pct_uptime = CALCULATE ( DIVIDE ( _uptime, 'Problem'[Total Time YTD] ), USERELATIONSHIP ( Problem[sys_created_on], 'Date'[Date] ) ) RETURN IF ( SELECTEDVALUE ( 'tablename'[X-Axis field] ) > EOMONTH ( TODAY (), 0 ), BLANK (), IF ( ISBLANK ( _uptime ), 1, pct_uptime ) )If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format, the Fields settings of your line chart and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- AnonymousNot applicable
Unfortunately, that didn't work. I ended up just creating a Date table and joining the two tables. When using the date field from the Date table on the x-axis I'm able to show 100% uptime for months where there is no data.
The issue as to why data was appearing for future months was when creating the relationship initially between my date table and data table, the date mapping was wonky. So I had to redo the relationship and ensure that both date fields being joined on were of the date datatype.
- AnonymousNot applicable
Hi Anonymous ,
In order to find the cause of problem and give you a solution shortly, could you please share a simplified pbix file with me? You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards