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.
Related
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.
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.
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.
Using PowerBI desktop, I have created a small table (called TimeSelector), with three elements: Day, Week and Month
The idea is to use the content of this table to create a slicer with three options
Thus, selecting one of those options should change the way dates are used in tables.
For instance, selecting Day would result in the following table:
While selecting Week would result in this:
Etc..
I have tried to write a new measure taking in account the selected slicer element, but it is not working:
DayWeekMonthSelection = IF(CONTAINS(TimeSelector;TimeSelector[DayWeekMonth];"Month");
MONTH(VALUES('uptime_downtime'[Uptime_date])))
This is only the first part of the formula, only testing the month option as a start.
Any idea on how to do this?
To offer another perspective:
The approach I take with this is to have a separate table in the database - containing meta data about the date, called date_lookup.
2 of the fields in this table are FirstDateOfMonth & FirstDateOfWeek.
Some of the other fields are lastDateOfMonth & LastDateOfWeek, also DayOfWeek.
By using these fields I can easily present visuals that are grouped by month or week.
Sure you can use functions to get this information, but functions can be platform dependant. If you're making a join to the date_lookup anyway - it's no more effort to get this info from there...
The main reason we need to store this meta data is our company Financial year is Jul - Jun. Therefore we need to have available the Correct FY - which is stored as a field in the date_lookup table. I also have fields in there identifying public holidays...
This is an interesting question, but I'm not sure how to do exactly what you are asking for, so I'll suggest an alternative. (Changing a measure based on a slicer selection isn't too difficult, but I'm not sure a good way to swap out a field/dimension.)
Instead of creating a separate table for your slicers, a different possible approach would be to create a date hierarchy. Often when you drag a date column into the rows or columns box it will automatically create a date hierarchy with Year/Quarter/Month/Date, but since you want week and not quarter, let's create one manually.
First, create a couple calculated columns for week and month. For example:
Month = FORMAT(uptime_downtime[Date], "mmm")
Week = WEEKNUM(uptime_downtime[Date])
Now right-click on the date on the fields, and choose New Hierarchy. It should look like this now:
Now drag the Month and Week columns onto Date Hierarchy and then rearrange them in the appropriate order:
Now you can use that hierarchy in a matrix and use the drill up and down buttons
to get the different groupings:
I'm trying to figure out how to get a measure to adhere to the filter set by a slicer in Power BI.
My DAX query is: Block Time Cost = SUMX( FILTER(v_Invoice_Line_Items, v_Invoice_Line_Items[IV_Item_RecID]=9), v_Invoice_Line_Items[billable_ext_price_amount])
I know very, very little about DAX so my initial query may be way off base.
It calculates as I expect, but when filter with a date range silcer the value does not update as expected or at all.
I'm pulling my data from two views in the same database, v_Invoice and v_Data_Combined. I have a page level filter on the row Record_Description to limit the data to the types I'm looking for and the measure pulls it's data from rows in the v_Data_Combined view.
The rows in v_Invoice are below.
A sample copy is here.
and the rows for v_Data_Combined, if you click they will enlarge.
A sample copy is here.
I have no relations set between the views.
How can I have a measure adhere to slicer filters?
The slicer has to be on the same table as the measures you're filtering, or on a table related to that table. If your slicer is on a column in v_Invoice and your data is from v_Data_Combined - and the 2 tables are unrelated in Power BI, the slicer from one table will have no effect on the data from the other table.
Without sample data (which can be fake data), it's hard to make further recommendations.
However, if the two tables you have aren't really related to each other, then I would recommend exploring the possibility of "lookup" tables. E.g. if you have Company_Name in both tables, then you might add a 3rd table that is a unique list of companies (their name, address, etc). Then, when you want to slice by company you would slice on this 3rd table. That slicer will then filter both related tables (without having to have the tables related to each other).
You can read more about data modeling in Power BI, and how to design lookup tables, here: https://powerpivotpro.com/2016/02/data-modeling-power-pivot-power-bi/