modelling
2 TopicsPercentage of total (context and model)
Hi, I am creating a measure to calculate a "% of total" taking in the context the date field, but it only works if the date field is in the same table as the other values, i.e., when I try to use the date field from my DimCalendar it won't work. What am I doing wrong? Is it the modelling or the DAX? PBIX file avaliable in my OneDrive here. This works: % of year total = VAR amount = [Expenses] VAR TOT = CALCULATE( [Expenses], ALLEXCEPT(English, English[Year]) // English[Year] is a redundant calc col ) RETURN IF( SELECTEDVALUE(English[Year], "-") <> "-", DIVIDE (amount , TOT, "Error"), "Select a year" ) This doesn't: % of year total = VAR amount = [Expenses] VAR TOT = CALCULATE( [Expenses], ALLEXCEPT(DimCalendar, DimCalendar[Year]) // This won't work ) RETURN IF( SELECTEDVALUE(English[Year], "-") <> "-", DIVIDE (amount , TOT, "Error"), "Select a year" ) Thanks in advance for any tip.Solved869Views0likes2CommentsCrossfilter and row level security
Hello, I have the following model for a report: I've been asked to implement RLS and I'm having some trouble figuring out the correct method. In my original model table 1 does not exist and is not required. Table 1 is added for RLS amd contains a list of users email addresses, and the IDs which represent the rows I want the fact table, table 2, to filter to. One ID can be accessed my multiple users in table 1 which is why it is a many>many relationship. The RLS is setup to use Userprinciple name to filter table 1 and subsequently table 2. This element seems to work fine, as I can see when RLS is applied, table 2 does filter to the correct IDs the person in table 1 has access to. Due to table 2 being the fact table and on the many of the many>one side, it does not pass these filters through to the associated dimension tables. I have been reading into this as it is new to me, and thought I could use crossfilter within my measures to make the filters flow through to the dimension tables. As an example, for a measure that counts the rows in table 3 I thought I could try something like the below to count the total rows in table 3, but only for the rows which match those filtered in table 2: CountRowsTable3 = CALCULATE( COUNTROWS(Table3), CROSSFILTER('Table2'[ColumnA],Table3[ColumnA],Both) When I do this calc I still get the total number of rows in table 3 without the RLS applied. Grateful for any steers on the best way to do this, or if I am down totally the wrong track happy to be told so too! Thank you1.9KViews0likes3Comments