Superset: How to Change Time Grain option dynamically - apache-superset

I have 3 time-series bar charts with different time grain values (day, week, and month) on Superset. The rest is the same.
Is there a way to make it (time grain selection) a filter or something so that I don't have to build very similar 3 charts?

You can select the "Show SQL Granularity Dropdown" when creating a filter box. This will allow you to change the time grain in the filter and allow you to have 1 chart, e.g. a time series table that you can change the time grain for allowing you to display DoD, WoW, YoY, etc.

Now with native dashboard filters in version 1.5 and beyond, you can click + ADD/EDIT FILTERS, then +Add filters and dividers, then Filter, then for Filter Type choose Time Grain. Then the user will be given a dropdown menu to control the time granularity.

Related

Power BI desktop loading sequence

Is there a way to set up a loading sequence for the elements in a desktop dashboard so that the slicer will always load first even though other elements might still be loading?
(i.e I change 1 slicer filter and the dashboard starts loading. Now I want to change a filter from another slicer, but I have to wait for the changes made from the first slicer to be loaded before seeing the different options to select from in the second slicer)
So I want the slicer to always load first, even though other elements might still be loading (as the slicer only takes 2 seconds to load whereas I need to wait 30 seconds for some matrices)
Any ideas would be greatly appreciated.
Unlike Excel you can't select all filter before the update of the visual.
Each modification of slicer would launch a request for your visuals.
The work around is to create another page with slicer synchronize with the same slicer on your page with visuals and switch on this page when you have properly parametrize your request.

how to display context for company events in BI

I am encountering a problem in BI (data visualization over historical data) that isn't unique to any BI tool (e.g., Power BI, Qlik Sense, Tableau). I need a way to add context (e.g., descriptive text) to certain events in my company's historical data, such that we don't need to explain anomalies in data visuals to new users of a report. For example, in a visual of sales over time, we want verbiage to appear in a tooltip for certain points in time. This verbiage will be created by report users and saved (somehow). So, this is like storytelling in BI, but with the difficulty that the verbiage / context needs to remain after dataset refreshes. It would be ideal to have this be tool-agnostic, but it's fine if it needs to be tool-specific (e.g., using Power BI's comments feature).
Is there a way to achieve this?
For summary reports (that display aggregated values) you may include these descriptive texts into the report as a special measure.
For example, let's assume that your report displays sales amount per year/month/category. In terms of SQL data for this report is loaded with a query like that:
select year(date_col) as dim_year, month(date_col) as dim_month, sum(amount) as sales_amount from transactions
group by 1, 2
To display some commentary text it should be joined to the aggregation result - for example:
select dim_year, dim_month, sales_amount, c.comment as sales_amount_comment from (
select year(date_col) as dim_year, month(date_col) as dim_month, sum(amount) as sales_amount
from transactions
group by 1, 2
) res
left join comments c on (c.year=res.dim_year and c.month=res.dim_month)
(assuming that comments table has columns year, month, comment)
Next steps depend on your BI tool, in most cases you can simply display 2 measures (sales_amount and sales_amount_comment) in the pivot table, if BI tools allows custom HTML formatting this could be a one table cell that shows amount value and displays the comment on mouse over (say, wrapped with <div title='comment text'>) or smth like that.
It is up to you how users will populate comments table; it can be loaded from Google Sheets, or simple custom CRUD app may be used to add/edit records.

How deselect a radio button on select of another in power bi?

I have used chiclet slicer to achieve radio button,
In my case from 3 measures I have taken 3 chiclet slicers, While clicking on a single radio button it is working fine, but on selecting another how to deselect the other two radio buttons.
I have data in 3 different measures "daily", "weekly" and "monthly".
My requirement is on the select of any those rest two options should be deselected, which is the default behavior of the radio button.
Or you can suggest me if there is any other way to implement the radio button.
I've always achieved this using the standard slicer and a hidden table with the needed labels and/or values.
Create a table by using "Enter data" or by using DAX, and put in it your 3 labels "Daily","Weekly","Monthly", I will call the table "MyTable" and the column "SwitchLabel"
Create a slicer with field "SwitchLabel", in the selection control enable "single select". (you can change the orientation in the "general" section).
Create a switch measure like the one below:
SalesSwitch = SWITCH( SELECTEDVALUE('MyTable'[SwitchLabel])
,"Weekly", [WeeklySalesmeasure]
,"Daily", [DailySalesmeasure]
,[DefaultMeasure] --optional "else", if nothing matches or there are multiple selections
)
Put the "SalesSwitch" measure in the charts.
The slicer/filter on the "switch" table must be present on every page that uses the measures, otherwise (without filter), it will always fall in the default case.
One limit of this solution is that it cannot change the X axis, in fact you are just calling different measures based on the selection.
If you need to also change the X-axis use Seymour's method with buttons and bookmarks.
There are many ways to implement the same need.
Buttons + Bookmark (built-in)
Slicer + Switch (built-in)
custom visuals in the store
In general, I prefer built-in Power BI functionalities because for enterprise production solution you do not want to rely on custom tools not officially supported by the software vendor.
Therefore, if your project is a real work then my suggestion is to use the Buttons + Bookmark built-in functionality. For your case you need:
Buttons
Bookmarks
In practice, create 3 buttons: Daily, Weekly and Monthly.
Next, create a bookmark with the default view, calling it Default.
Then, update one bookmark for each of the three view. It could simply be hiding or showing a visualization in the same page. Please note that a hidden visualization will not trigger any computation when the page is opened.
Finally, set the action of clicking the button to direct the user toward the bookmark.

Face KPIs using two slicer values

I am trying to compare Charts and KPIs in PowerBI report. In fact, face the same figures tables but with different slicing values (time room, countries...)
I could only create two tabs with basically the same slicers and visualization. But I couldn't put them one aside the other that apply to that tab.
Can anyone help me with this.
Many thanks,
You have several options, here are the simplest two:
Use visual level filters to display two visuals with different filtering
There are three levels to the Filters sub-pane - "visual", "page" and "report" - they control the scope of a filter.
When editing a visual, you can drag any data field to the Filters sub-pane's "visual" field-well and configure a filter affecting only that visual.
As a simple example: for a table with "Sales" and "Country" columns, you can create one KPI visual showing sales and configure its filter to "UK", then create another KPI (or just copy the first one) and configure its filter to "France" etc. Using this approach you can create several KPI visuals in the same page, each displaying sales data for a different country (Tip: you'll probably want to edit their titles so that viewers can tell which KPI shows what).
Use Edit Interactions to have slicers that affect only some visuals on the page
In Power BI Desktop, go to Format tab in the ribbon and click "Edit Interactions". This causes each visual to display several small buttons on its top right corner - these control how the active visual affects each other visual (typically you can select between "highlight", "filter" and "no interactions", note that not all visuals supports all three options).
As a simple example with the same table from above, you can create two KPI visuals showing sales and two slicers filtering by country. Then, edit the interactions so that one slicer affects only one KPI and the other slicer only affects the other KPI. This will create an interactive report with two KPIs comparing sales between any two countries - according to the user's actions on the slicers.
Finally, these posts from MS Power BI have detailed tutorials (including screenshots) for the two options described above:
Visual level filters
Visual interactions

Show Different type of Data in Same Visual In Power BI

I have a scenario where I have a column in a table which is having multiple project list.
And each project is of different type.
And the types are for ex FP and T&M.
Now as we can see in First image , Charge Ratio is showing for FP type Projects and Second Image showing Bill Utilization for T&M Projects
.
My Requirement is ,I want to show both The Charge Ratio and Bill Utilization in One Visual According to the Project Type.
I have a slicer which user can choose the projects.
If the choosen project is T&M type then it should show visual according to that type.
If it is FP then in that line chart only, i would like to show the visuals according to that type.
Note:- I don't want to use the slicer for TYPE selection
Please Give me suggestion.
Thank You.
You can show both the charge ratio & bill utilization in a single visual.
Simple Solution
A simple solution would be to remove Project from your chart legend and instead have 2 measures on your chart: one for Charge Ratio and one for Bill Utilization. Since only one measure ever applies to any given project, the chart will only ever show one line for any given project. However, you'd need to use the legend to identify what measure is being shown. Further, you'd need to ensure only one project is ever selected at a time: otherwise, it will aggregate the ratios of different projects together.
Alternative Solution
Since the Charge Ratio only applies to FP projects, and Bill Utilization only applies to T&M projects, you can create a single calculated column that identifies the type of project and shows either the Charge Ratio or the Bill Utilization as appropriate. E.g.
Ratio =
IF (
RELATED ( 'Project'[Project Type] ) = "FP",
[Charge Ratio],
[Bill Utilization]
)
You could use the same logic to create a "title" column too:
Ratio Name =
IF (
RELATED ( 'Project'[Project Type] ) = "FP",
"Charge Ratio By Month (FP)",
"Bill Utilization By Month (T&M)"
)
Finally, you can have a title measure to handle when multiple projects are selected (possibly of multiple types):
Ratio Name Measure =
IF (
HASONEVALUE ( 'Ratios'[Ratio Name] ),
MAX ( 'Ratios'[Ratio Name] ),
"Charge Ratio & Bill Utilization By Month"
)
Throw that measure into a multi-row card just above your chart, and it looks like this:
I recommend utilizing Bookmarks, a button, and visibility controls to toggle visibility between two different charts.
Go to view and check Bookmarks Pane and Selection Pane. Add two copies of your chart, two bookmarks, and Home >> Button twice.
All assets are nested on top of each other. Save one bookmark with a button visible and the other hidden. One chart visible, and the other hidden. Save the other the opposite way. Make sure to name all of your assets so you can keep track of them. Go to your bookmark and update it.
Click your button and go to Action and turn it on, set both to opposite bookmarks.
Final state will have a button that switches to the other bookmark, and one that flips back to the first. One will turn off the chart for FP and turn on the T&M, and the other will turn off T&M and turn on FP.