Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to create a more dynamic date filter for a report of mine that shows past and predicted data. I would like a filter that only shows data related to the current month and the12 months to follow. For example from June 2016 to June 2017. But I would like BI to be able to recognize what the current month is so that when the next month begins it can automatically adjust the filter. Meaning that when June ends I would like BI to automatically adjust the filter to show July 2016 to July 2017. I would really appreciate any help or ideas people have. I have attached an image of my current table.
Thanks,
James
Solved! Go to Solution.
Hi,
PowerBI has filtering wizards, so I could provide you with M code but I think it's more useful for you if I show the process for using the wizard:
I'm using a dataset of mine, with a date column. Click on the down arrow with the column header:
Then go to Date/Time filters -> In the Next...
That should open up a window where you can select these options:
And
Hi,
You have two ways in doing this, M or DAX. I prefer the latter because it is straightforward and it doesn't require refresh of the data model. Here we go:
DAX:
Current Month = IF(MONTH(DimDate[Date])=Month(NOW()), "Current Month", Format([Date], "YYYY mmmm"))
Select a slicer and sort by date, this will make sure it puts Current Month always on top.
M:
= Table.AddColumn(MonthName, "CurrentMonth", each Date.IsInCurrentMonth( [Date] ))
Regards,
Fahd
I assume that you want to show the current and future Sales for the next 12 months in a chart.
Try the following
1. I am assuming you have a date table
2. Create a Column in the date table called as MonthSequentialNumber as
MonthSequentialNumber = year( date in date table ) * 12 + Month( date in date table) - 1
This will create a unique number for each combination of month and year.
3. Create a measure called CurrentMonthSeqeuntialNumber = Year(Today()) * 12 + Month(today()) - 1
This will find the MonthSequentialNumber based on todays date.
4. Create a column in Date table called Show as
Show = IF (
[MonthSequentialNumber ] >= [CurrentMonthSeqeuntialNumber ] &&
[MonthSequentialNumber ] <= [CurrentMonthSeqeuntialNumber ] + 11, 1, 0
)
5. Show will have a value of 0 or 1 in the date table.
6. Assume you have a measure called [Sales] that calculates the sum of Sales . As per your requirment I am assuming your sales records contains future predicted sales.
7. Create a bar chart where x-axis is Month and Y- axis is Sales measure.
8. In the visual level filter for the bar chart drag the field Show and set the filter condition show items when the value is 1.
9. You will then be able to see the Sales for the current month and the future 12 months from Now.
Should you require further assistance , please do not hesitate to reply to this post.
If this works for you please accept it as a solution and also give kudos.
Cheers
CheenuSing
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |