Power BI too current date filter / dynamic bookmark - date

So I have a sales KPI's page in power bi with 2 full years of data and the current year which is updated monthly / daily, So in order to display data up to the current month we have data for and compare them with prior years I currently have to select all the months individually so for this month I have to make 11 clicks on a month slicer to not be comparing a skewed amount of data with the prior full years..
so my question would be, is there a way to make a slicer or button for an entire page to click just once and show data for only up to the completed dates of data in the current year, just to help efficiency for the end user. I don't want a measure to add to every single visual, just a button or slicer on the page to turn off and on.
I want to stay away from relative date filters that do not update automatically, I don't want to have to go in every month and change it on my end, I want the end user to just push an action button.
Thank you!

You have two options that will fit your use case.
Use the relative date filter, that will show the data for the current year
In this example the relative date filter is set for this year, and will only show the date in that range. The dataset does contain values from 2019 to 2021, but only shows 2021.
The second option is to create a calendar table with items such as 'Current Month', 'Current Year', 'Current Day' etc to drive that filtering if the relative date filter doesn't fit your use case. This example works out the current year
You can set the page filter to filter on items in the current date range, every time the dataset refreshes, it will update the range to take into account the current day, year, month or what ever you define

Related

PowerBI, DAX. Is there a way to set an upper limit to a slicer?

I'm trying to create some measures using DAX on an underlying data model which I would then use for creating some visuals (line chart, bar chart etc.). Each table in the data model has a data field (date&time) that contains repeated dates and times (more occurencies with the same date&time). To use the metrics in the visuals I need the measures to be grouped for date (only date, not for time).
To achieve the task I've created a calendar table (using CALENDAR in DAX) to set-up a set of dates (only dates) to which refer at for every table in the data model and created relations (dates that points to calendar date) for every table. I set the upper limit of the calendar table to be a year ahead of the max date in the dataset, because some measures need to be evaluated in the future.
In the visual pages, I put a slicer that points to the calendar table dates, but the date interval is too wide. I need the slicer to have a more narrow interval, let's say, only "for the present and the past" but I prefer not to add another calculated table.
In your opinion, is there a way to limit the slicer without changing its reference to the calendar table?
Thanks!
For the calendar you may just use CALENDARAUTO(). It will expand automatically as the data model expands.
For the slicer, just select it, open the filter pane and define a filter with the upper limit you want.
You can use combination of 3 different slicer for your purpose. This is just another option that you can have a look on. There will be 3 slicer for Year, Month & Date. So Date slicer is you final slicer, with 2 other slicer on top of it to generate necessary Dates in the slicer. This way, you are not making any static restriction to generate the Date list but giving the user full control on the Date range. Here below is a sample how the slicers can be look in practical.
User can select any year or multiple year, any month or multiple month. Finally the date slicer will hold Date values accordingly.

How do we calculate difference and percent difference between two columns in tableau

]Difference and percent Difference must be calculated.
I cannot do Apr20-MAy20 because it is not always the same. I need to show the current month and previous month
So I did a relative filter to just show the current month and previous month.
So the difference of two columns should automatically change when the month changes.
Now how do I get the same month of prior year, how do I filter ?
I also need to calculate the difference of current year same month and previous year same month.
Thank you in advance for any help!
When I do table across difference, the difference value is overwriting the existing May and Apr month values as the below screen shot, how to show the difference in another column
Currently:
Below is Expected:
Sounds like you should create a custom filter for the dates. You want:
This month this year
This month last year
Last month this year
There are a number of ways you could do this. I'll give one example and will assume there aren't any future dates in your data set.
[DateFilter]: DATETRUNC('month',[YourDateField])>=DATETRUNC('month',DATEADD('month',-1,TODAY())) OR DATETRUNC('month',[YourDateField])=DATETRUNC('month',DATEADD('year',-1,TODAY()))
Put the to the filters shelf, set to True, and it should keep the months you want.
Then you can just use the standard table calculations to calculate Difference and Percent Difference.
Note, the formula isn't tested, just typed directly into here, let me know if it doesn't work
Based on your comments look at creating separate calculations for to YoY / MoM / etc calculation. That also means creating calculated fields to isolate the Current Month, Previous Month, etc.
For example, the current month:
[isCM]: DATETRUNC('month',[YourDateField]) = DATETRUNC('month',TODAY())
The previous month:
[isPM]: DATETRUNC('month',[YourDateField]) = DATETRUNC('month',DATEADD('month',-1,TODAY()))
Then month on month, something like:
[MoM]: (SUM([Measure])*INT([isCM]))/(SUM([Measure])*INT([isPM]))
To make your table check this article about using the placeholder technique to create tables in Tableau

Month filter to be defaulted to current month whenever user opens the report

I have a month column in the data and I am adding this as a filter so that user can filter whichever month he wants.
I want the month filter to be defaulted to current month whenever user opens the report and then he can change the month based on his needs. Is this possible in spotfire?
You can create the calculated column with the following definition and pick current month as a filter.
If(Month([Date])=Month(DateTimeNow()),"Current month",String([Date]))

Dashboard with auto-updating current and previous month in Tableau

I'm working on a dashboard in Tableau desktop and I want it to automatically update for the current and previous month, each month to show % change in simple, numerical terms (not graphed).
Is there a way to fix the previous month and current month numbers?
Sound like all you need is to use Relative Date filters. https://onlinehelp.tableau.com/current/pro/online/mac/en-us/filtering_add_dragfields_dates.html

Tableau: time series chart displaying last day of month instead of first

In any time series chart, it looks like Tableau defaults to the first day of the month on the tick marks.
Is there a way for Tableau to show the last day of the month instead?
You can sort of force it by going into "Edit Axis", starting it on a month end, and 1 as the monthly interval. However, this is not a dynamic process and would require that I update this every time I had new data.
Anyone have any ideas? Thank you!
If in your data series you want each data point to represent the whole month, and you just want to label it with the last date of that month, then this workaround might work:
use calculated field to coerce all dates in the month to the last date of that month: DATEADD('day',-1,DATEADD('month',1,DATETRUNC('month',[Order Date])))
use this field as date in your time series
use 'More -> Custom -> Month / Day /Year' as display option for this field