I am now experimenting with "Analyze in Excel" feature in POWER BI. I would like to use the RLS to load RLS filtered table (NOT to actually analyze the OLAP Cube with pivot table)
I have successfully set up row level security using this Table filter DAX expression:
SEARCH( userprincipalname(), [Email], 1, 0 ) > 0
After creating a dummy Measure=1 I was able to double click ("drill through") the Pivot table (by double clicking on the measure value in the pivot table). This gave me a linked table with the following command text:
DRILLTHROUGH MAXROWS 1000
SELECT FROM [Model] WHERE
(([Measures].[Measure],[Table1].[email].&[xxx#xxx.xxx],[Table1].[ID].&[4],
[Table1].[X].&[654]))
After removing the filter part =>
DRILLTHROUGH MAXROWS 1000
SELECT FROM [Model]
WHERE (([Measures].[Measure]))
=> I was able to get a linked table with all the columns and rows. Also the RLS works: when I refresh from a different account I see only the allowed/limited rows. - Amazing! (Using Office 365, signed-in account)
This is how to get the linked table:
double click on measure in OLAP Pivot in Analyze in Excel file from POWER BI
My goal was to set up a linked EXCEL table with working RLS (without using MS SQL server or other) - this seems to work now!
My questions are:
Will the connection obtained via "Analyze in Excel" be working PERMANENTLY or is it only TEMPORARY?
Can I modify the "SQL" command text even more to return the whole table/data set? Something like "Select * From ... " - (of course while respecting the RLS)
Is this approach reliable? Can you think of any downsides?
Could someone exploit the connection to ignore the RLS?
Warm regards.
Jakub
Related
I have created a SSAS role but members of this role are unable to insert an excel slicer. Normal pivot table behaviour is permitted - can select permitted measure groups. There are no dimension restrictions in place. I get "A pivotTable, cube function or sliver using connection XXXX has failed to refresh. Continue to refresh all?". Even after refresh I am unable to insert a slicer or select from an existing one.
I've tried out slicers and can't see them doing anything particularly weird to the query Excel sends to SSAS - like creating a cube or set. (You can see the MDX Excel is using by installing OLAP Pivottable Extensions).
When I select dimension members in the slicer, the MDX changes from a
SELECT
....
FROM Cube
to a
SELECT
....
FROM
(SELECT .... FROM Cube)
where the inner SELECT includes the slicer tuple in the WHERE.
Maybe post some more detail about what this role isn't permitted to do? (probably the reason you created it).
I'm using an up-to-date version of Excel 2016 (via O365 E3 license) and using Power Query / Get & Transform Data. I can successfully create queries and load them to the page. I have also successfully created Power Pivot reports.
I would like to query single data points from the data loaded via Power Query. For instance, imagine a dataset called DivisionalRevenue with:
Date Division Revenue
2016-01-01 Alpha 1000
2016-01-02 Alpha 1500
2016-01-01 Beta 2000
2016-01-02 Beta 400
I could easily load that to an Excel workbook or include it in the data model and create a power pivot. However, Power Pivot doesn't always meet my requirements, particularly around how the data is displayed on the page. In order to achieve my goal I may want to be able to query individual data points.
I would like to have a cell on the page with a formula in it that I can use to query individual data points. If it was in a pivot table I could use something like:
=GETPIVOTDATA("Revenue",$A$3,"Date",DATE(2016,1,1),"Division","Alpha")
The lookup values (date and division) could be retrieved from a cell on the page or hard-coded into the formula. This is a requirement for several reports I'm working on.
Or, I could add a combined lookup column with Date and Division concatenated and use a vlookup to pull the values like:
=VLOOKUP("42371Alpha",I9:L13,4,FALSE)
Finally, I could use a combination of INDEX and MATCH to identify the correct row number and then pull the data.
All of these solutions require the data to be loaded onto a sheet. One requires a pivot table that has to be refreshed to work properly. The other two require creating arbitrary lookup columns so that you can match a row based on more than one field (date and division in this example), and you have to ensure that that lookup field's formula is properly extended down the length of the data table. In both cases I would have concerns when sharing this workbook with my colleagues in case someone affects the rather fragile setup of the pivot table or the lookup.
So, what I truly want to find is something equivalent to pivot table querying against a dataset.
** This doesn't exist, but I would like to know if something like it does **
=GETQUERYDATA("Revenue","DivisionalRevenue","Date",DATE(2016,1,1),"Division","Alpha")
Does such a thing exist? Can such a thing be done? Can I retrieve arbitrary data points from the dataset created through Power Query / Get & Transform Data?
I think that what you want are cubefunctions:
Some Background
How to easy create cubefunctions from a pivot table
There is a feature in Excel that allows you to query off of a PowerPivot model, but it's not highly advertised for some reason.
Once you have the data in your PowerPivot model, go to your Excel -> Data tab -> Existing Connections -> Tables tab
From there, choose the table that you want to start with. Once that table's data is on your excel sheet, you can actually right click that table -> go to "Table" -> "Edit DAX"
From there you can enter the following DAX function, as an example
EVALUATE
FILTER(SampleData,[Date]=DATE(2016,1,1) && SampleData[Division]="Alpha")
Make sure to choose Command Type=DAX in the drop-down. Here's how it looks on my screen:
To further improve your querying power, you can install the optional "DAX Studio" plugin for Excel, which allows you to write custom DAX queries and then export the results directly back to an Excel sheet.
I'm on Excel 2013
Is it possible to EXPORT a powerpivot table and have FULL pivot table drop down functionality without the connected data?
1) I'm using slicers as filters and want to export specific files based on the Filtered Names
2) Would non Power Pivot / Power Query users be able to view my workbook? (I'm thinking probably not)
I've scoured forums and stackoverflow and was unable to find a clear answer.
I've tested it myself and disabled connection and it looks like the LAST format the PowerPivot table was showing would be the view/data that the user sees.
I agree with your test results. Anyone on Excel 2016 / Office 365 should get full functionality.
You might want to try the free Power BI service, where you can upload your Power Pivot model to the cloud and then connect to it using the Power BI Publisher Add-In.
https://powerbi.microsoft.com/en-us/documentation/powerbi-publisher-for-excel/#connect-to-data-in-power-bi
You can set a CSV file with your data as your data source in powerpivot and just point your data model at the CSV. I do this to slim down big models. The data lives in the powerpivot cache level but is not a literal tab in your workbook also much smaller footprint. Works like a tiny database connection. Go to the powerpivot screen choose "From other sources" on the home ribbon, and scroll to the bottom for a text file or CSV. Easiest way to make a pseudo-data mart.
I guess I am not sure what you mean by export the table, The pivot would show without the data connection, but without the full model behind it in the data layer changing anything would just lock it up.
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:
I have data in powerpivot that I've modified and I'd like to place it into the workbook as a regular table (and not as a pivottable). I need this so that I can run use the table for some vlookups from another worksheet in the same workbook.
I found this answer: link which I will try and summarize with out cutting and pasting to much. This assumes you have powerpivot installed.
goto powerpivot and "import from and external source" the data you want to munge and bring back into the workbook as a table
Key here is to select the checkbox “Enable selection of multiple tables”.
when prompted at the "import data" window, pick pivot report (you won't really use this)
go back to powerpivot with the "Manage Data Model:
add a new measure below your data. something like: NRofOrders:=COUNTROWS(values(FactResellerSales[SalesOrderNumber]))+0
(you won't really use this but this seems to change the query to this table so that you can use DAX)
also add any columns that you want ( for me, this is want I wanted that I wanted to be reflected back in the workbook)
back to Excel, select the data tab, click on Existing connections and select Tables: and then pick a table from your query.
boom, you're done
(the link continues on and you should read that as it's interesting but at this point you should have powerpivot query with your modification as a table in your workbook)
The July 2014 update to Power Query (pushed out at the end of Aug) simplifies the answer. With the new Power Query Update you can pull the data into the Data Model with out having to also copy it to the Works sheet.
goto powerquery and import the data you want to munge. Use the option to just add it to the Data Model.
go back to excel and then go to powerpivot with the "Manage Data Model" button.
munge your data (add columns, whatever)
back to Excel, select the data tab, click on Existing connections and select Tables: and then pick a table from your query.
boom, you're done
In the PowerPivot window you can select the table, or elements of it, and then copy (nornal right click or ctrl +c) and paste that into your spreadsheet.
This works for reasonable amounts of data but if you try and do it with thousands of rows you may find that excel objects and falls over, based on my experience.
Vlookups kind of defeat the purpose of PowerPivot :-)
Found a great solution over on Mr Excel
(http://www.mrexcel.com/forum/power-bi/637919-extracting-static-data-powerpivot-without-pivot-tables.html)
If you are trying to get a PowerPivot table into Excel, then you can simply query it. The easiest way to set that up is to first create any pivot table based on you PowerPivot data. Then double-click the measures area to drill-through. This creates a table with a connection to your PowerPivot model. Then edit the command text by going to: Data > Connections > Properties > Definition tab > Command Text.
Change it to something like
Code:
EVALUATE Table1