how to display context for company events in BI - powerbi

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.

Related

Filtering by Date and changing measure

I'm trying to build a report in a table that returns a count of completed checklists that are filtered by 2 Date Intelligence slicers. I have the targets for that month in a table, but I'm not sure how to change the measure by what's selected in the slicer.
I would like the measure to return the Target.Monthname of the selected slicers from the table Targets. The slicer is based on the DonesafeFolder Table with "Date of Completion"
Your question is a bit hard to understand.
But from your pictures, I think you should take a step back.
when using powerBI it is recommended to use a star schema, with facts and dimensions tables. Usually you model that when you import your data (with power query).
When using a star schema you also have a date dimension with the month on the rows instead of columns and powerBI is better at handling data structured like that. to lean about designing the data model you can read MS's guide to star schemas
Of cause, if you know what you are doing, you can use your approach, but it makes things alot harder.
BTW. you can't access the values in the slicers/filters directly. they filters the column you select which are then passed to the measures you create. If your datamodel is sound they should indirectly filter your measure.

Best way to organize data from multiple companies in Power BI

Basically I have a big Excel dataset about 500x500 with economic information from various companies.
Each row is representing a different company and in columns we have the information. A little bit of it is qualitative like ZIP code, type, etc. But most of it is quantitative. For each of the quantitative info, we have info for 5 years, so we have one column for each year and for each information i.e. Debt 2019, Debt 2020, etc.
So my question is which is the best way to preprocess this data to work with it and how should it be done. Either doing the preprocessing with Excel, running a Script on PowerBI, using Query, SQL, ...
The objective is to have a report which will be accessible online and the user will type the name of the company and it will show them the dashboard with the information of that company (only that one), so they can navigate through it.
The structure and which information is shown is the same for each company, the only thing that changes is the "numbers" that each company has. So it has to be possible to change which data is showing (to use the one from the company they want).
It also needs to be able to show comparative data to other groups of companies or to the total.
I want to have it right from the start, because then changes get complicated.
I thought about doing sort of a "relational model" with one "table" for each company with the quantitative data (with one row for each year and each column one info point) and then a general table with the qualitative data (with rows being each company and the columns the info). But I am not really sure.
I know how to use Power BI but I have never used it for something this big. I would like to know which way to organize this data is better and some info on how to do it.
Many thanks to everyone.
I thought about doing sort of a "relational model" with one "table" for each company with the quantitative data (with one row for each year and each column one info point) and then a general table with the qualitative data (with rows being each company and the columns the info).
Yes, do that.
General guidance is to use Power Query in PowerBI to transform the data into a star schema model. See Understand star schema and the importance for Power BI
So that would typically result in one table that has the "dimension" data for each company, a date table, and a "fact" table at the grain of (CompanyId,Date) with the quantitative data.

Power BI with SQL Analysis Services: how to "Hide" all not used tables from "Fields"

When I work in Power BI Desktop connected to SQL Analysis Services, my model looks like this,
Enter image description here
And the "Fields" tab on the right spans for more than a page long:
Enter image description here
In reality I actually use only a few tables and a few columns in those tables + my measures.
To simplify that look, I can go to ellipses near each tables title, and hide that particular table. I also can do this on "model" tab, but in my case, when I have a few dozens of tables, it is time consuming.
Is there a way how to "hide" all not used tables and columns, to help report consumers to comprehend the model and my calculations?
You can also easily hide multiple fields in Power BI Desktop. The best place to do that is to go into the Model tab. Then select all fields that you want to hide (using Ctrl or Shift with selection), and then in the Properties tab beside it, turn the Is Hidden property to On.

Power BI / DAX return values from table from rows filtered out by slicer

I have a table visualisation that shows the populations of countries and a toggle switch that flips between 'sold' and 'unsold'. (This works with a measure that checks is a country is present in a sales table and assigns a 1 or 0 which is then used as a filter on the table visualisation).
Various slicers in the dashboard are used to filter the data model and retain the details of sales. When 'unsold' is selected therefore, the relevant countries are already filtered out of the countries data table and it is not possible to display them with their populations.
At the moment the workaround is to use a duplicate countries table that only has a one way filter, so that the rows remain regardless of filtering. This means that other slicers which interact with the rest of the data model don't filter the table visualisation as desired.
I am sure this must be possible using some combination of CALCULATE(), FILTER() and ALL() but I haven't managed to achieve this.
N.B. I can force the unsold countries to appear in a table visualisation using a constant measure (with formula: measure_name = 0) in a column .
Apologies if this is not very well explained, any help much appreciated.
Thanks for reading,
S
Image attached to (hopefully!) explain problem better.
Real scenario is more complicated hence not screenshotting from PBI.

PowerBI slicer value passing to query

I have a report generated from a SQL query, having a due date column. My requirement is to create a slicer and  whatever the date a user selects in the slicer the report should show all the data where due date is less than the selected slicer date.
I am not able to pass the slicer date to my SQL query. 
Can you guide me guys in finding the best possible way?
This is not possible in general. Slicers and filters set on a report page cannot modify the model (e.g. calculated tables or calculated columns) and cannot modify the queries.
The only possible way to do this sort of thing is with a DirectQuery, which does it automatically in the background since it dynamically queries only the needed data. Otherwise, you need to pre-load all of the data that you intend to use in the report.
Using DirectQuery has significant limitations and may or may not work for your use case. Please check the limitations and considerations in the linked documentation for details.