I would like to add a slicer/filter which has to pass as a parameter to stored procedure/View and get the data from the DataBase. Know how to pass a parameter from Power BI to SQL Server, but don't know how to add the parameter as a slicer
Related
I have a SQL query I am using for a workbook requiring multiple pivot views from the same dataset. Part of the query is looking at a declared value and based on that value it will either return one result or another, that declared value however needs to be a parameter that end users will input into the workbook.
Normally I would use the excel function to pull the data from the SQL server and then pass a parameter in the advanced query option using " Let Parameters = Excel.CurrentWorkbook()".. however the result set it too large and therefore I need to use Power Pivot.
I however for the life of me can find no help on how to pass a parameter from a cell in a worksheet to power pivot - is this possible, is there a VB script I can use to update the query, alternatively what other options are available other than having to get the end users to go into power pivot and edit the query in the properties each time?
As the variable is used in a computation, I am not using the parameter to filter the dataset and that seems to be the only advice I have been able to find. I am new to Power Pivot.
I came right by doing the following:
Add the SQL query in Power Query, as a data connection only. In the advanced query options, I added the required parameters.
I then selected the query and selected the option to load to Data Model.
Seems to be working.
I've created a report that uses SSAS to create a Pivot table. I have to authenticate with username/password when I refresh it. Once it's refreshed I want to send it to someone else.
However when they open it they can't drill down in the Pivot table because it asks them to authenticate as well.
I can't remove the connection from the file because then you don't have the data for the Pivot so it doesn't let you drill down either.
Is there a way to work around that, to make the Pivot table available for use (to drill down, no need to change the fields) to the other person?
If you want to provide a self-contained Excel file with the detail data to support an interactive PivotTable then please look at Power Pivot. In newer versions of Excel it is called the Excel Data Model. You load the model with detail data, define your calculations and relationships between tables. The data is compressed and stored in the Excel file so except during refresh from your relational source (which you could do before sending the Excel file) the user doesn’t need any access to servers.
You will have to rebuild the data model in Power Pivot. If your SSAS model is a Tabular model then the concepts should be pretty similar.
I'm using Excel 365 and pulling in a table via Power Query. In the underlying SQL, I use an ORDER BY clause to sort the data, which works correctly in the PowerQuery preview and in my SQL client. But I noticed the table that winds up getting loaded in Excel isn't sorted in the same order. I added a sort step to Power Query as the final step, and it still didn't work, even after I wrapped the step in Table.Buffer(). I have also tried it with and without the Preserve column order/sort checkbox checked.
It only honors the sort settings if I uncheck the box to load the query into the data model.
How can I make it follow the sort as specified and load into the data model?
I have power query M code that generates the table from JSON input, I am able to load to the DAX using close and apply but I need a way to programmatically load the result set from power query to DAX.
Where can I start?
Edit
Data in power query window:
Using below controls I load the data into DAX (here DAX means load to power pivot data model) or Excel sheet.
Everything looks fine here when I used the Excel/power query controls to load data.
My question here is instead of using Close/Load (Second image) is their any way using code to pull data out of power query.
So. I have prepared an MDX query in SQL Server Management Studio (SSMS) which shows me the result that I want. However, I would like to query it from Excel instead of from SSMS, so that I can work with the figures and create graphs and such.
My MDX could look like the following:
SELECT
[Dates].[By Month].[Month].&[2015-02]
ON 0,
(
[Region-Office].[Region Hierarchy].AllMembers *
[Measures].[Earnings]
) ON 1
FROM [Model]
When querying this MDX in SSMS, I get the result that I want: namely that both Region and Office is printed to only one column:
Above MDX query returned from SSMS, note that both region and office is in the same column
When I turn to Excel and create an MSOLAP.6 connection with the following connection string:
Provider=MSOLAP.6;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=CubeData;Data Source=CubeServer;Extended Properties="VisualMode=2";MDX Compatibility=2;Safety Options=2;MDX Missing Member Mode=Error
I get a different result: namely that region is printed to one separate column and office printed to another separate column:
Above MDX query returned to Excel table using MSOLAP.6, note that region and office is printed in two separate columns, which is not what I want
Can I in any way control what the Excel table returns so that I can retrieve the same output as the one I query in SSMS?
Thank you very much in advance!
The connection string you supplied is the same as I have when using excel's out-of-the-box SSAS connection wizard to a pivot table, so I'll assume nothing more complicated than that.
If in a pivot I add a multi-level dimension to rows I get behaviour like the following - for a "classic" pivot:
I can create a custom set in Excel like the following:
That set then becomes available to use and all members are in a single column: