Power BI report help finilizing - powerbi

enter code hereI am trying to make equipments availability report from 3 tables linked together by specific date, say for example (03/03/2019).
That date will return the jobs that we did in some equipments. When run the report I got only the equipments that have jobs on that day say I have 10 machines and I did only 3 jobs on that day so my result report will have only 3 rows I want my reporThe image show samplet to have 10 rows with only 3 rows with information about the jobs.
On that day but I need my report to show all the equipments even those has no job on that day. In Access it is easy by editing the relationship properties and chose keep all records from first table.

Related

Multiple FACT tables to create a matrix visual in Power BI - creating measures to display multiple values

I was working on a data set and had few queries on how to model the data.
I have two FACT tables with the following fields
Budget table
Team Category
Team name
Service line
ID
ID_name
Employee Name
Rank
Location
Employee category
Week ending date
Hours
Revenue
Cost
Revenue or hours category
Actuals table**
Team Category
Team
Service line
ID
ID_name
Employee Name
Rank
Location
Employee category
Week ending date
Hours
Revenue
Cost
Many to many relationship exists between the tables. I have created a calendar table and a Service line table to help me filter across tables which are created as DIM tables.
The initial output I am looking for will look like the attached image
Output visual
Similar tables to be created based on Team category and Team name
I tried to follow two approaches – first one by maintaining them as separate tables and creating multiple measures for the each of the required fields. However, I was not able to get to the attached table visual
Secondly, I appended the two tables by adding an additional column named Budget and Actuals to the respective tables. Then, Hours, Revenue, Cost was unpivoted and made as the attribute. Measures were created for actuals, revenue = E, forecast, budget and variance. In this scenario, I could recreate the above output. But, could not create revenue per hour and cost per hour metrices
Can someone guide on how to move about this data model.
There are couple of other DIM tables that can be created, but that doesn't save space or is useful in filtering

Powerbi ability to create snapshot data from a historical table of data

I have a sql database linked where I have the complete history of products and users. I want to the user to be able to select on the slicer a year and the data automatically shows active prodcuts, expired products and new products added in that year (or snapshot).
Is there a way this can be done? I am not able to find a measure to best do this for me.
I recommend creating a date dimension table first - I usually call mine Calendar. Please read this useful post by Radacad which will show you how to create one > https://radacad.com/power-bi-date-or-calendar-table-best-method-dax-or-power-query
Once it's done create relationships between your fact tables and calendar table on key dates of when your products are active or expired - I'm making a huge assumption that's what your tables store.
Your calendar table will then act as a single time/date point of truth and should be used to slice and dice your fact table.
Hope this helps!

Dynamic filters with power bi reports

I have a very big database with a lot of tables. Let’s imagine this is Amazon customer database.
I have several users which want to make queries on this database. For example : « give me all customers which live in this area, are between 20 and 30 years old, have spent between 200 ans 300$ in 2017 and which did not made any order last 6 month and which visited product pages talking about video games last 3 days ».
Queries can concern every table and every field. I do not Know at development step which criteria will be needed by users. It can change every day.
What i need is to provide an universal query tool.
I have deployed power bi and i need to add dynamic filters inside the report but i do not know how...
My problem is i want to embed filters INSIDE the report
Thanks

Strong Consistency when you need to query multiple entities (thousands)

In an application that has many 'shops' every registered admin user has a 'shop' entity, each shop sells items where each item belongs to a certain 'category'. Having multiple clients (100's in some cases) each client has an account to follow up on their purchases and past orders. Each shop generates invoices for their clients, clients pays the invoice.
Admin User -- > Shop
Shop ---> clients
|-> items Categories
|-> items
|-> invoices
|-> payments received
An admin page shows a report showing invoices within the year (from Jan to Dec) this page is a client requirement. The shop is able to manually generate a new invoice when a purchase is made, and records a payment when it is paid. Note: This all happens in the actual shop, there is no online client purchases.
As a single shop generates few invoices per month (~100's), and multiple payments per month (~100's), showing this per year easily goes to thousands entities to show on a single page.
To optimize loading the page and generating the sales year report (total sales, revenue, payment...etc.), we thought we'd structure the data in a way where each item category per year is also an entity. This means that whenever a purchase is made for an item in this category, we need to add the item's purchase price to the itemCategory at that year in this month.
itemCategory Model:
itemCategory(ndb.Model):
shopID = ndb.KeyProperty()
year = ndb.IntegerProperty()
monthly_sales = ndb.FloatProperty(repeated=True) #12 months
This way we can load the entire sales table by reading just the list of itemCategory for this shop for this year, instead of reading all individual purchases through the year. This would save lots of Datastore reads and decrease page load time on the expense of an extra read, sum & write to this summary like entity.
Category Jan Feb Mar ... Dec
--------------------------------------
Men's shoes 1000 1300 850 ... 1400
Kids shoes 600 850 650 ... 900
The challenge at this point is that strong consistency is quite essential, for individual purchases and for the itemCategory entities. Because if the shop tries to add multiple purchases in a successive short timed way, with eventual consistency itemCategory might have not been updated with the last purchase sum yet. Resulting in wrong sales values. Also the same for individual purchase if there was a requirement to edit one right after it was added, a query for the entity without its ID might have no results. So it seems that Ancestor queries is essential here with maybe the shop as the parent entity. Yet, this will result in a contention issue later on (at least until Datastore is migrated to Firestore) with all those entities (thousands in this case!) having one single parent!
The same goes for invoices, generating a new invoice means knowing the latest invoice number so that they are always in sequence without gaps. Querying invoice with eventual consistency may result in duplicate invoice numbers.
What is the optimum way to structure the data at this point for strong consistency? Unfortunately the project has been there for a few years, and was started using Google Datastore rather than Cloud SQL (which seem to be more appropriate for this kind of projects). Hopefully all these issues goes away after the migration to Firestore having Strong consistency for all reads
Consider exporting the data and then importing it into a Cloud Firestore in Datastore Mode project. No more eventual consistemcy issues.
There are certain ways you can achieve strong consistency.
Query using key. Whenever you try to read an object via its key it is strongly consistent.
Another approach would be to use NDB Asynchronous Operations. See related documentation here.
A really naive approach would be to provide a delay which could help you but the delay should be provided in such a way that it is sufficient for the object to get updated.
And the final approach could be to export data into Cloud Firestore. There you can achieve strong consistency always.
Hope this answers your question!!!

Table Visual Limiting Rows

I have a list of invoices for varying days. In the same report, I want to show a table of invoices created the previous day and another table showing invoices created in the previous week.
How do I limit what data is in the tables? I can create the table fine, but it shows everything; the only way I can limit it is by page-level filters, but i want these two tables on the same page.