Two different date ranges driven by a single slicer? - powerbi

My data source is a list of events. There is one column with a timestamp, and other columns are attributes (type, location, severity, etc) of that event. I would like to produce a "weekly report".
Most of the charts on this report will be based on the events that occurred in the user-selected week. Example: column chart showing count of events per location. Other charts are to show the current week's counts compared to previous weeks. Example: line chart showing the total count of events in each of the last 12 weeks
I believe I can achieve this by having two separate slicers, one for selecting the dates of the current week, the other to select the comparison range, and each chart linked to the appropriate slicer. Ideally, however, the user would be able to select a single range (e.g. the week of the report) and the second set of charts would be relative to it. Is this possible?
I produced the following example using 2 slicers, both referencing the Date field, but one slicer for each chart. I want both charts controlled by a single slicer:

Related

How to set last 2 months as default filter in a power bi dashboard

The user when opening the dashboard needs to see the last 2 months filtered with slicer not selected
if user select any date in slicer, then the graphic should be filtered according to the slicer (not only 2 months)
You can use the relative data filter to show the last two months of data on your report. This will track over the time without needing to update the date.
What you can then do if you need the user to put in their own date range it to use a bookmark to remove the date filter to the full date range, which the user can select.
Using two bookmarks one to clear the data range and one to show the last two months. You can layer the bookmarks and control the visuality, and even the slicer type if required.

Line and Stacked Cluster Column

I have 2 table with in power BI. In first table "CASH FLOW TABLE", first column consist of name of jobs, second column is date, third column is cash flow of these jobs according to months. In second table "PROGRESS TABLE", first column consist of name of jobs, second column is date, third column is cumulative percentage progress of each jobs according to months. I try to use line and stacked column for these two table. For line values, I used cumulative percentage progress, for column values I used cash flow for each job. And for shared axis, I took date and job names from one of the table. I also manage relationship between two table. Then, I add filter visual to filter graph according to job names. But when I select one of the job, for example if I took date and job names from "CASH FLOW" table, when I filter job, only column values changes according to job, line also change but not goes cumulatively according to date, I can see only straight line which equals single value that is sum or average of progress of each job. Similarly, when I select one of the job, for example if I took date and job names from "PROGRESS" table, when I filter job, only line values changes according to job, column values also change but not according to date, I can see only single column values for each date. I want to see change of line cumulatively, and change of column values according to real values related with each date. Could you please help me?

Add customizable date range comparisons to a Power BI Table

I am trying to recreate a Tableau table view in Power BI where I can compare two customizable date ranges and show the percent differences across metrics as a calculated row.
Reference Screenshot from Tableau
In practice, my table will have 3 rows: 1 row for each time period selected and a row for the percent difference. The percent difference row is a nice to have, not a need. All my table metrics are coming from the same source.
I also need to set up two different date slicers that each row of my table will reference. I've played around a little with setting up a separate date table for the comparison period to be selected from, following this thread: Comparing Data Across Date Ranges
The challenge now is showing two separate periods in the same table.
Appreciate any guidance!

In Power BI, how can I create a column that changes based on a slicer and visualization?

I'm pretty new to Power BI. I'm unsure how to approach this.
I have one visualization that displays the ten most frequently bought products in a time frame that is set by a slicer. In another visualization, I display how those products have been selling over the past few years (this time frame is not determined by the slicer). I want to display only the ten products that come from the first visualization, not the ten most common over the time frame in the second visualization.
How can I accomplish this? The approach I have in mind (and I'm open to others) is to create a true/false column that changes with the first visualization. "True" would be for products that are frequently bought as determined by the first visualization in the slicer-determined time range, and the second visualization would only look at values with a "true" in that column. How can I create a column (or table, maybe?) that changes depending on a visualization?
Clarification: most of the pages will say Top10 ... Actually, the measure used was a simple Top5 that includes products with the same number of orders than the 5th product. Therefore, to avoid dealing with larger images, 7 products will be seen but it is a Top5 ranking. The idea is you can replace it with your custom TopN measure.
What I understood:
The simplification of your model plus the disconnected help table would be:
I have one visualization that displays the ten most frequently bought
products in a time frame that is set by a slicer.
The Date slicer belongs to the Dates table in the Data model.
The table viz represents the number of rows in the sales table in the
current context (for each product within the Date range).
The table viz is sorted according to the [#Rows] measure in descending
order.
The table viz only presents the TopN products even without the presence
of the [#Rows] measure due to the presence of the [TopOrders]
measure within Filters on this visual. [TopOrders] is 1.
On the second page you create:
A slicer with the Dates[Date] column (the same one used on the
previous page).
A matrix with Products[ProductName] on the rows, HDates[Year] on
the columns, and a measure on values.
From the View tab, you select the Sync Slicers option.
Inside the Sync Slicers pane:
In the Sync column, check the boxes related to the necessary pages.
In the Display column uncheck the box that contains the over
years report.
So far all we have done is pass the time frame context from page 1 to page 2.
Since the TopN context depends on the time frame context, we can now use the [TopOrders] measure as a Filters on this visual in the matrix. Again, [TopOrders] is 1.
Why do the numbers differ between rows and not between columns?
Also, in this example, the Sales table only has information up to 12/31/2020 but the visualization shows an additional year and the Sales[Amount] values for each order is $1 so that [#Orders] and [SalesAmount] are the same for easy comparison.
HDates is not related to the model and for each combination of HDates[Year]-Products[ProductName], the [SalesAmount] measure is using the information coming from the previously hidden slicer and the respective Products[ProductName] because the information coming from HDates[Year] has no effect yet.
In order to complete this exercise, it only remains to modify the [SalesAmount] measure in such a way that it removes the filter on the time frame (Dates[Date]) and it recognizes HDates[Year] as Dates[Year].
SalesAmount :=
CALCULATE(
SUM(Sales[Amount]),
ALL(Dates),
TREATAS(VALUES(HDates[Year]),Dates[Year])
)
And this is the final result.
I hope it works for someone or the idea can be improved.

Dynamic column change in visual based on slicer in power BI

I have a chart as below,
Here I have certain metrics which needs to be shown as Monthly, quarterly, yearly.
Ex. if monthly is selcted chart should show in months as mentioned,
if quarterly is selected chart should show in quarter and same applies for yearly.
So I tried with following code,
Created a table,
|Monthly|1|
|Quarterly|2|
|Yearly|3|
Created the selcted value measure as
select = selectedvalue('table1'[column2])
Created a switch to use that calculated column in axis of the bar chart,
switch[select]
1,'calendar[Month]',
2,'calendar[Quarter]',
3,'calendar[year]')
Output is showing as variant data-type cannot be used in calcualted column,
I understand that some values are either text or number, how to change accordingly to same datatype.
I have tried with zero also it is showing the same error.
Is there any other approach to this dynamic changing of columns?
You can add buttons and use bookmarks to assign action based on Month, Quarter and Year to those buttons, all you need to do is create 3 visuals and align them then based on buttons make the visual visible/invisible and the update the bookmark.