I am a new user of power bi and i wanted to know two things.
Is it possible to get data from mysql datasouce in real time based on query.
how to dynamically change the mysql query parameter based on slicer. e.g. if i have a query
select * from table name where date = 10/12/2019
than i want to change the date dynamically based on slicer visual
say in my slicer i have dates of different months and I select 12/01/2020 from slicer than the above query should act based on 12/01/2020 i.e select * from table name where date = 12/01/2020
How can i achieve this in power bi?
What you are looking for is called Direct Query, but that's not supported for MySQL data sources. (Datasource supported feature list)
You might be able to do some tricks on PowerBI Desktop using templates and ask for parameters first, then run a query. But that's not the proper usage of the functionality and you won't be able to use it anyway in the PowerBI Service (since you can't deploy a template). This also tends to be tricky and requires a good amount of manual work in M language (Power Query)
Summarizing, for your case I think the answer is no.
Related
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.
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.
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.
We're trialling PowerBI on a Snowflake dimensional model and performance seems very non-optimised. Can anyone point me to information on best practices for this connection? I've previously used Tableau and there's an excellent white paper describing the pros/cons of each connection type and how to set this up so that as much heavy lifting as possible is done in Snowflake, with minimal load on the viz tool.
e.g. when you summarise 1 million invoices to get a chart of sales volume by year that distils this to 10 data points, Tableu would send 'SELECT year, sum(volume) FROM t GROUP BY year' (~10 rows), but in PowerBI we see SF receiving a query like 'SELECT invoice_id, sum(volume) FROM t GROUP BY invoice_id' (~1M rows) - leaving the viz tool to do a lot more work.
So far, we've tried mapping the individual facts and dimensions within PowerBI, and also using a mix of direct query and import, but without significant improvement. Is there any guidance on best practice?
Thanks in advance!
I've never used Snowflake, and I have no clue about how PowerBi interfaces to it. That said on the PowerBI side you may be interested in the composite model and aggregations.
MS Docs:
https://learn.microsoft.com/en-us/power-bi/desktop-composite-models
https://learn.microsoft.com/en-us/power-bi/desktop-storage-mode
https://learn.microsoft.com/en-us/power-bi/desktop-aggregations
Radacad's blog about aggregations:
https://radacad.com/power-bi-fast-and-furious-with-aggregations
https://radacad.com/dual-storage-mode-the-most-important-configuration-for-aggregations-step-2-power-bi-aggregations
In practice, when you are using a composite model the aggregation functionality allows you to create a hidden table (in import mode) in your model with aggregated data (by year, month, customer, etc).
Now when you query your data, PowerBI will check if this table can answer the query, if yes then it will just pick the data from this table, otherwise, it will run a query against the source (direct query)
The example you shared about PowerBI querying the source without asking for aggregation (but instead asking for every single InvoiceId) might be caused by not setting up the composite model correctly.
A table in "direct query" cannot reference other tables in its query (in this case the calendar) unless that table is also in "Direct query" or "dual" mode.
How does the model look like in the case you shared? and which is the storage mode of each table?
Is it possible to refer from Power Query (M) to DAX calculated table? I would like to get DAX table as a source to my power query.
The purpose. I have grouping table made in DAX. I would like to make econometric model with R. So I would like to transform the DAX table with R to get the model parameters. I would like to use these parameters further in DAX measures (not just display them).
Currently I dump the DAX grouping table to Excel file and then pull it up with Power Query.
Actually, there is a way.
DISCLAIMER: This is a hack. You should not rely on this way.
1. Create DAX calculated table
Input any DAX formula that evaluates to a table in Modeling > New Table.
2. Check port number using DAX Studio
Connect to your PBI Desktop data model using DAX Studio, and check the port number where the data model is hosted. It should be displayed in the right bottom of the window.
3. Import the table to Power Query
Click Get Data > Analysis Services and input the address (in my example "localhost:50293") to Server. Then navigate to your DAX calculated table.
it's not possible to refer to a DAX calculated table in M as it's loaded into DAX/Power Pivot engine after M has done the transformations. You can't write to a DAX table after loading into R as well. You can do grouping in M, or if needed run R in the Power Query. One approach that I have used has to load the data, duplicate the query, run a group/filter on the new query, then use that data in a later stage in the report.
Hope that helps
Jonee is correct. This is not possible. DAX calculated tables are computed after the M queries have loaded and you cannot feed them back into Power Query without saving them externally like you are currently doing.
The M language is more powerful than you might think and very likely could do the same grouping operations, though depending on what they are, it might be fairly difficult. You can also use R or Python script within an M query if you are more comfortable with those.