Relative Date Functionality in Power BI:
Issue #1:
Hi Team,
Need to know is there any way to implement the below relative date filter functionality in Power BI
Please note the following:
For year the base year should be current year, for now it should be 2021
For month the base month should be current month, for now it should be july and so on.
Issue#2:
Based on the above, we want to implement a functionality based on the below selection, where in if we select week, then we should see the count of a metric only for the weeks which are passed by the above filters and similarly for months, days etc. For eg, if we select year, then we should get the count for the year 2022 only as this is the only year passed by the above filter.
Thanks for any help!
Technically possible? I think so. Feasible? No, not really.
While there is some playroom with bookmarks, custom graphics and clever use of a wide range of measures and calculation groups - it would be an enormous task to get everything running correctly and smoothly.
Perhaps one option is to introduce this filtering functionality via a custom visual that takes your date column as input?
Related
I am trying to create a tab in Power BI that includes a Year to Year Comparison for a month using a slicer on a date hierarchy, but I'd like the user to be able to chose which years are being compared (for future-proofing the report). This involves using 3 slicers on the report - 2 for the choice of 2 years, and 1 for the month of interest. I haven't yet found a way to get the data to show up for the graph I want.
I created a mock page that displays the type of report I'm looking for, but it only has a month slicer, and utilizes built-in page filters to constrain the years:
Reference image for what I'd like the graph to look like
What I'd like to create is a page with the filter options shown here, but it's not outputting any data, much less anything like the first graph (unless I have both year slicers to be the same):
Has the slicer options I want, but data doesn't show
I've looked into including some Time-Intelligent DAX functions, but from what I can tell, nothing seems to be an obvious solution for what I'm trying to do.
Start with two measures - one each for year 1 and 2 - to show the data for those years, and two unrelated slicer tables driving the year selection. Each measure can then pick up its year value (via SELECTEDVALUE) to use for data filtering.
I am trying to create a Dynamic Table in Power BI.
I have my set of data, and basically I want the calendar to pick up the minimum date and the maximum date from my table, but only if the maximum date is not the month of today. If the maximum date is the month of today, then it should ignore it and the calendar should be created with the max date of the previous month.
I started the formula, but can't seem to continue it. Any ideas?
Calendar_= CALENDAR(MIN('Table1'[Date]),IF(MONTH(MAX('Table1'[Date]))=MONTH(TODAY()),date(YEAR(MAX('Table1'[Date])),.....
See if this post helps: https://community.powerbi.com/t5/Desktop/Dynamic-table-or-on-fly-table-generation-via-DAX/m-p/434397#M200275. If not, I would simplify by creating some additional calculated columns or measures and then reference those instead of one nice big formula
THis is an example of what I think i need to do
I would like to ask some modeling advise I cannot solve myself:
I am using Power BI to visualize the time machinery is out of order.
The source is a register of equipment not functioning, with a start date and end date (note that there is no end date if the machine is not fixed yet).
I would like to show the time (hours, percentage, etc) that the machinery is out of order, filter for a specific period /date (e.g. month).
So I have 2 date columns: ‘’Start out of order’’ and ‘’Back in order’’
I do have a date table, which I usually would connect to all the date variables. However, since I am working with a Start and End date. This does not give the result I am looking for.
Any help is very much appreciated!
Kind regards,
Link to my Power BI FILE:
https://wetransfer.com/downloads/83ca3850392967d0d42a5cc71f4352c420200213160932/eb7353
Stijn
I am not sure how you would like to visualise your data, but this is what I managed to do:
create a daysdiff column with
Daysbetween = IF(ISBLANK(TF_Eventos
[End out of order]);DATEDIFF(TF_Eventos[Start out of
order];TF_Eventos[TODAY];HOUR);DATEDIFF(TF_Eventos
[Start out of order];TF_Eventos[End out of order];HOUR))
This creates your column to check difference between Dates.
Then create a separate column with your Date. In this case I copied the Start out of order date, since I thought you might wanted to be able to filter for the start dates. Then simply create a relationship between your newly created Date column and your start out of order date.
Doing so lets you create a visual with the daysbetween (in this case portrayed in hours) and your start dates. Now just simply add a slicer and you can filter on date.
Hope this helps
Using PowerBI desktop, I have created a small table (called TimeSelector), with three elements: Day, Week and Month
The idea is to use the content of this table to create a slicer with three options
Thus, selecting one of those options should change the way dates are used in tables.
For instance, selecting Day would result in the following table:
While selecting Week would result in this:
Etc..
I have tried to write a new measure taking in account the selected slicer element, but it is not working:
DayWeekMonthSelection = IF(CONTAINS(TimeSelector;TimeSelector[DayWeekMonth];"Month");
MONTH(VALUES('uptime_downtime'[Uptime_date])))
This is only the first part of the formula, only testing the month option as a start.
Any idea on how to do this?
To offer another perspective:
The approach I take with this is to have a separate table in the database - containing meta data about the date, called date_lookup.
2 of the fields in this table are FirstDateOfMonth & FirstDateOfWeek.
Some of the other fields are lastDateOfMonth & LastDateOfWeek, also DayOfWeek.
By using these fields I can easily present visuals that are grouped by month or week.
Sure you can use functions to get this information, but functions can be platform dependant. If you're making a join to the date_lookup anyway - it's no more effort to get this info from there...
The main reason we need to store this meta data is our company Financial year is Jul - Jun. Therefore we need to have available the Correct FY - which is stored as a field in the date_lookup table. I also have fields in there identifying public holidays...
This is an interesting question, but I'm not sure how to do exactly what you are asking for, so I'll suggest an alternative. (Changing a measure based on a slicer selection isn't too difficult, but I'm not sure a good way to swap out a field/dimension.)
Instead of creating a separate table for your slicers, a different possible approach would be to create a date hierarchy. Often when you drag a date column into the rows or columns box it will automatically create a date hierarchy with Year/Quarter/Month/Date, but since you want week and not quarter, let's create one manually.
First, create a couple calculated columns for week and month. For example:
Month = FORMAT(uptime_downtime[Date], "mmm")
Week = WEEKNUM(uptime_downtime[Date])
Now right-click on the date on the fields, and choose New Hierarchy. It should look like this now:
Now drag the Month and Week columns onto Date Hierarchy and then rearrange them in the appropriate order:
Now you can use that hierarchy in a matrix and use the drill up and down buttons
to get the different groupings:
Is it possible to create trailing 12 month date parameter? I want to be able to choose Month-Year, so it display data till the end of that chosen Month-Year 12 months back.
Something like that on a picture below.
Do I need to create some date measures for that?
Thanks
I would use the Relative Date slicer & filter feature built into Power BI. It can cater to that requirements E.g. Last - 12 - Months (Calendar)
https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-slicer-filter-date-range/
No modeling preparation is needed - it is set in the report page design.