How to write a DAX formula on an RLS SSAS? - sql-server

I have a data model that is like this:
Joins are done between tables on storenumber and storename.
I would like to give access to the stores staff but they only see the sales of their own store. I added their mail in the table Y2_Stores.
The sales data are in the table Y2_Sales.
In analysis services I added a role "Stores" in read, in Membership I added the email addresses of the stores, on the line filters I put that but I see in the microsoft documentation that it is necessary to make a formula with the functions LOOKUPVALUE() and USERNAME() but I do not know how to build this formula..
I tried this formula in Y2_Sales line:
=Y2_Sales[storenumber]=LOOKUPVALUE(Y2_Stores[storenumber],
Y2_Stores[email], USERNAME(),
Y2_Stores[storenumber],
Y2_Sales[detail_number])
I tried this too:
Y2_Stores[email] = USERPRINCIPALNAME()
Can you help me to write the correct DAX formula?
Thanks a lot
UPDATE :
I added the Y2_StoreEmployee table with storenumber | email and made a relation on storenumber in double direction to the Y2_Stores table :
Relationships:
I created a role with this formula:

There should be a table related to Store, eg StoreEmployee, with (StoreNumber,Email), configured for bidirectional cross filtering with Store. Then the RLS filter filter is on StoreEmployee and is just Email=USERPRINCIPALNAME().
So each user sees only their own rows in StoreEmployee, that creates a filter that propagates to Store, and then to the Sales, Inventory, and Images.

Related

Master Data Services - Leaf members Subscription View

In MDS, I set up an entity with a simply hierarchy:
MasterGroup
-- SubGroup
---- Product
There are a few other entities, basically functioning as pick-lists for columns on the Product level. I.e. Sales has their way of looking at products, which they split into 5 categories. Finance does the same, but they only want 3 categories.
The product thus looks like the following:
ProductCode (internally generated by MDS)
ProductName
ProductSubGroupValue
LookupProductID (From source system, which lacks these departmental categorization)
FinanceGroupingValue
MarketingGroupingValue
There are about 40 products to be grouped using this hierarchy, with all non-specified products to be dumped into a "catch-all" category.
Everything looks fine, the products have been set up, I can see all the data when I use the Excel MDS plugin, and so I created a view using my Hierarchy to expose the data in SQL Server, and using SSIS I will then source the above columns.
Is this the correct way to set something like this up in MDS, or would you advise me to use a different approach?
Thanks :)

SQL Server Reporting Services 2005 how to create nested groups

I know it's old technology (ancient now), but it's what I have to work with due to work.
I am able to create a Group and report and link it to a textbox to provide a collapsible report, with master data and detail data.
What I want to know, is it possible in SSRS2005 to create another sub-group to the first group?
i.e. Master record -> Detail -> Sub-details
Every time I try and add another detail row for example I only get one row of data in the sub-group, because it's tied to the Details Grouping. I cannot explicitly say "report grouped by this other subgroup" (where it offers you to create groups in the Group list).
Yes I am trying to do this in a table.
This is what I am after...
[+] Col1 Col2 Col3 Col4
[+] data data data data
Col1 Col2 Col3 ...
data data data ...
...
...
The [+] is what I want to set up to allow the expansion of another group within the first group.
The answer is not to try and pack too much into one reporting object. In this case the Table object.
I managed to have far more flexibility by placing the tables and fields inside a List object.
Try these...
Drop a List item into the report
Define the Dataset to your main dataset that contains all the data.
Note: For this to work you need a query that have as much as the master and detail data inside as ONE query, so obviously your master data will repeat as deep as it has to, to get to the lowest common dataset, which in my case was the action items per student.
The List object will act as the Master data reference for all your other objects inside of it.
Now you can play! Drop in a few textboxes to show the data for the master data you want to only show ONCE per "logical record". I'll let you ponder what that meant!
Now to show subgroups, you'll need Tables for each one. Drop a Table object
In each table (group) don't specify a dataset, as I said above, all the data comes from the List.
But for each table, you'll need to define your Details Grouping. Go ahead and simply state the group parameters you require for the sub-group. So in my case, I want to display ONE row of Students, but any amount of Actions each student has. So place a StudentID for the student and an ActionID for the actions as a combined grouping.
Repeat the above for any other groups, and define their groupings so you don't get repeatitive data. One table could only have one pivot or group, so just define the index for that inside the Details Grouping. Do not use the Add.. feature to add groups, because you'll be adding groups within subgroups and go into another level again! Beware.
I hope this made sense.

Microsoft Dynamics AX 2012 R3 XDS Security on Finacial Dimesion

I'm trying to create an AX security framework for one of my client. The key task here is to enable Branch Accounting in AX 2012 R3 environment. Which means i'm required to filter different transactions / customers / vendors / Transfer orders on the basis of Location & Financial dimension BU respectively such as Each Branch (location) should see records of there respective branch.
I created my custom security roles enabled XDS framework on them, it was easy in the case of customer, vendor etc for which I had an Location wise field.
But in case of transactions i.e 'LedgerJournalTrans' Table I am not able to filter on the basis of Financial dimension. As the field LedgerDimesion is a combination of different dimensions its hard to use it in a AOT query.
If any one give an insight on how to filter transactions or any other records on the basis of Financial dimension combinations ?
Note: I've already studied the white paper to filter through dimensions on XDS but the example mentioned there is based on the myDepartment table and methods which I cannot use in my scenario
Link to White Paper for reference
You have to create a query or view to get values for each ledger dimension.
You can get this info by joining DimensionAttributeValueGroupCombination (this has ledger dimension id), DimensionAttributeLevelValue (field DisplayValue is the dimension value), DimensionAttributeValue (DimensionAttribute RecId).
Now you can use this view or modify it to filter by dimenison values.
MyDepartments temp table has a method named XDS which is automatically called to fill the data. Refresh of this table can be per session or per invocation.
You can use this to make your own user based filter data.
You can add some code in the init() method of your Query that you use in Your XDS policy.
the code should get the ledgerdimension field and get the dimension value that you want to filter based on the user dimension mapping.

Custom query which returns to data block output in Oracle Forms Builder?

I have these tables
BOOKS
ID | GENREID(number) | COUNTRYID(number) |
GENRES
ID | TITLE
COUNTRIES
ID | TITLE
In my form BOOKS, I need to display:
ID GENERES.TITLE COUNTRIES.TITLE
All I need is to JOIN tables or SELECT data from all tables and display it. It seems that this is impossible with Oracle forms designer. My data block output displays data from the BOOKS table with inserted ids, but not with titles corresponding to those ids from separate tables (e.g. GENRES, COUNTRIES). I can't find where to put a custom query to data block.
I am using latest oracle dev suite home. How do I do this?
There's two common ways to do this:
Use a post-query trigger to populate non-database display fields and an LOV to allow them to insert and update those fields.
Create a view in the database and base your block on that.
The first one is the easiest but they won't be able to search on those non-database fields without a lot of extra work.
The second option allows search but adding and updating data in a view introduces some problems. I usually use an on-insert, on-update, on-delete, and on-lock trigger to handle those function manually and modify the base tables.
http://sheikyerbouti.developpez.com/from_clause/from_clause.htm
--> Read the Step 3
I'm using that one a lot. With that you can build your own queries to Forms and also get block which you can insert/update/delete (of course to one table). And this is how I for example do block which has like user id and user name fields.
But at least in my Forms version it's not possible to change query in run time because it's changing data_source_type back to default.

HABTM-Relation : Create a relation for all other records

If i want to add a record to TABLE A, is there an efficient way to add
a record in the JOIN TABLE for many (or all) records in TABLE B?
I try to build a simple task management (in CakePHP). An user adds a task and there
will be added a connection to each other user in the same group as the
current user.
At the moment, I use the find('list')-method to retrieve the IDs and
store them in a variable. But I think if the groups grow, the PHP
cache won't handle this amount of data in a single variable.
You should look into the Cake Has-And-Belongs-To-Many (HABTM) relationships. Check the cake book. It will allow you to create a relationship between two tables, using a join table, and will automatically retrieve and save values as requested in your application.
Please note, however, that from one model you cannot (by default) filter by criteria on the related model (in this case, the model related by the join table). To do this, you will need to use the Containable behavior, which will allow you to set filter criteria on the related tables.
The one other caveat is that I don't know of a way (out of the box) to add some information about the relationship in the join table. For example, if you wanted to record (in the join table) whether the user has completed the task, you would have to write your own stuff there. I usually get around this by creating a model for the join table, which I then invoke whenever I want to retrieve data specific to the joined relationship. By doing it this way, you can also easily pull up the data from the joined tables. Anybody else have a better solution?

Resources