DAX SUMMARIZE function isn't respecting row-based security in my Power BI Model - filtering

I'm adding Row-level security to a Power BI model and it's working on all the normal tables, but there's a DAX table created from a SUMMARIZE that's ignoring the security. I've created a small model that reproduces the issue - am I doing something wrong here, or is this behavior intentional?
Here's my data model - "Raw Table" is just a manual table with some numbers in it and a filter column:
"DAX Table" is created with a SUMMARIZE statement that just makes it a copy of the manual table (since every row is unique anyways):
DAX Table = SUMMARIZE('Raw Table', 'Raw Table'[Number], 'Raw Table'[Filter])
Here's what the content of the tables look like when nothing is filtered:
I've added row-level security that filters the Filter table to just the "Show" records:
And through the join, this appears to filter the Raw table normally - when it's enabled, I can only see the rows with "Show" in them (as expected). However, the DAX table continues to show everything, even the filtered rows that I'm not supposed to see:
What am I doing wrong here? Since I'm not allowed (via RLS) to see the rows labelled "Hide" in the raw table, shouldn't those also be excluded from the SUMMARIZE statement? I realize that adding a slicer on the Filter table and slicing the Raw table doesn't impact the SUMMARIZE statement (I still see all the rows in that case) - am I just seeing the same thing here? Since I'm prevented from seeing these rows based on a security setting, I'd expect them to be hidden from my DAX as well.
Assuming I'm doing this correctly and this is intentional, how can I create a DAX table that does respect my security filters (as I need to do this in my full model)?
Here's a link to the testing PBIX file as well.

Calculated Tables (and columns) get calculated when the model is loaded, and materialized. Not at runtime.
You will need to connect that table to your model so security propagates there aswell.

Related

Ignoring space characters when linking tables

I’m experiancing a problem when trying to link to tables in the database expert. The two fields that link the tables have exactly the same information except one table always has an additional space. For example;
Table 1 = Multivitamin/Tablets
Table 2 = Multivitamin//Tablets
‘/‘ are representing spaces
Formulas won’t help (e.g. extractstring etc) as it’s the tables themselves I need to link together
This is preventing me from retrieving the information I need. Any advice on how I can get around this?
There are some ways to come across this:
Consider using a command as datasource instead of tables. When writing the query of the command you can define the join condition yourself.
If you have access to the data source, you could add a calculated field to the tables to contain the normalized field values and then use these for linking in CR.
Alternatively, one could create views in the database, either adding normalized "linking fields" or providing the joined tables results.
If it's only a few rows in CR, you could consider using SQL fields or subreports to retrieve data from Table 2.

ssas tabular model use roles so customer can only see suppliers used

I have a ssas tabular model that has dimCustomrer, dimSupplier and a fact table.
I created a role for customers so they can only see themselves and this works perfectly fine.
Is it possible for the role to filter the Dimsupplier table so they can only see the suppliers they have used?
Searching google I can't find anything that seems to help.
Do you want to filter dimSupplier based on the fact table? Yes, that is possible by enabling bi-directional filtering on the relationship between dimSupplier and the fact table, and also setting the security filtering behaviour to "both directions":
However, bi-directional filtering can have some performance impact if your model contains large amounts of data.
Alternatively, you could import an aggregated version of the fact table, that only contains all the distinct combinations of customers and suppliers (2 columns). Call this table BridgeCustomerSupplier, or something like that. Then, you add a row-level filter to your role on the dimSupplier table, and use LOOKUPVALUE, to see if there's a matching record in BridgeCustomerSupplier, for the current supplier (in dimSupplier - the row context), and the current customer.

How to filter dashboard based on quick filter values selected in Tableau ?

I'm having Dashboard-1 with the data source from SQL Server Table-A having columns
Col1,Col2,Col3
Now, i'm creating a new dashboard-2 with data source as Table-B having columns Col1,Col4,Col5.
But Col1 which is common in both these tables doesn't have common data.
Eg. Col1 from Table-A is having records till 100 and Table-B is having records from 101.Also, the data is not static, its keeps on increasing in Table-B , Table-A is no longer populating but we need the data from it.
Problem1-- How to merge two column as single column for filter in Tableau
Problem2-- in the dashboard i need to show single filter as a union of Col1 from both tables, if user select value <100 then Dashboard-1 will open otherwise Dashboard-2.
Can someone provide me a correct approach.
1) Instead of merging after you have brought the data in, try merging the data using SQL UNION.
2) If that's not possible, do the same after importing both the datasets into Tableau. For an example, try from this official link
3) Try different Joins to see which one works for merging your table columns:
4) If all the above fails, try setting up an Action Filter explained in this link. Essentially you have to use Tiled Containers instead of Floating Containers and set up a action filter using a custom Parameter. This custom Parameter will help display Dashboard 1 when user selects <100 in the filter(for example) and Dashboard 2 when user selects >100(again example)

Crystal: Autoupdating table names in database expert

It is more of an annoyance rather than real issue: when in Crystal reports you change the data source to one with different name (and do all the linking old columns to new columns) all the table names in Field explorer and (obviously) in formulas are changed. But the Database expert still shows the old table/view name!
Let me show this on example: Lets say I change TABLE_1 with column EQUIPMENT to VIEW_1 with column UNIT. Via the datasource location I can do the substitution and link old column EQUIPMENT to new one - UNIT.
But when I check either Datasource location or database expert it will be still showing old TABLE_1 (if you check the columns in the link tab you will notice that the TABLE_1 has now column UNIT instead of EQUIPMENT).
This can be quite annoying and frankly bit dangerous, especially if you return to report after a longer while. Is there somewhere a setting that allows to autoupdate table names in the database expert?
When you create the report it will create tables and each table will be linked to a datasource table. So the report table will have a name and datasource , which might be the same. When you change the datasource the datasource of the table will be updated but the report table name will remain the same. Think about this name as an alias. It might differs from th datasource name if you use the same table multiple times
I don't think there is auto update option in crystal reports but one thing you can do is to use Verify Database option under Database tab whenever you update the tables.
You need to manually edit table names in Database expert, there's no automatic way (and like Lan already answered, it is generally not possible).

iPhone Dev - Trying to access every row of a sqlite3 table sequentially

this is my first time using SQL at all, so this might sound basic. I'm making an iPhone app that creates and uses a sqlite3 database (I'm using the libsqlite3.dylib database as well as importing "sqlite3.h"). I've been able to correctly created the database and a table in it, but now I need to know the best way to get stuff back from it.
How would I go about retrieving all the information in the table? It's very important that I be able to access each row in the order that it is in the table. What I want to do (if this helps) is get all the info from the various fields in a single row, put all that into one object, and then store the object in an array, and then do the same for the next row, and the next, etc. At the end, I should have an array with the same number of elements as I have rows in my sql table. Thank you.
My SQL is rusty, but I think you can use SELECT * FROM myTable and then iterate through the results. You can also use a LIMIT/OFFSET(1) structure if you do not want to retrieve all elements at one from your table (for example due to memory concerns).
(1) Note that this can perform unexpectedly bad, depending on your use case. Look here for more info...
How would I go about retrieving all the information in the table? It's
very important that I be able to access each row in the order that it
is in the table.
That is not how SQL works. Rows are not kept in the table in a specific order as far as SQL is concerned. The order of rows returned by a query is determined by the ORDER BY clause in the query, e.g. ORDER BY DateCreated, or ORDER BY Price.
But SQLite has a rowid virtual column that can be used for this purpose. It reflects the sequence in which the rows were inserted. Except that it might change with a VACUUM. If you make it an INTEGER PRIMARY KEY it should stay constant.
order by rowid