Forum Discussion

daxesh's avatar
daxesh
Frequent Visitor
9 years ago
Solved

Rankings using DAX

Hello , My Data and implementation: Schoolid           No. of Student           StudentGroup --------------------------------------------------------- S1                            10      ...
  • vinaypugalia's avatar
    9 years ago

    You take below approch to acheive your requirements.

     

    You can prepare one more dimension table for School lets's say Student_RLS, Which will be the copy of table mentioned above

    -There should be no relationship between copied table and original table , Import both the tables to power BI.

    -Implement RLS , on copied table.

    -Original table is independent of RLS implementation and All ranking calculations will be calculated on original table.

     

    And your formula would be updated to below

    RankMeasure:=MAXX(FILTER(ADDCOLUMNS(FILTER(Student,Student[StudentGroup] = "11-20"),"Rank",RANK.EQ(Student[No. of Student],Student[No. of Student])),Student[Schoolid] = VALUES(Student_RLS[Schoolid])),[Rank])

     

    I am assuming , you are going to login with one school at a time to see report and your ranking measure as you have also mentioned that "Row level security is implemented on the Schoolid , Let's say School with user Schoolid = S1 will able to see data only for school with id=S1".

     

    So your RLS will be implemented on Student_RLS[SchoolId].

     

    Hope, this helps!

     

    Thanks.

  • daxesh's avatar
    daxesh
    9 years ago

    Great!

    your solution worked for me

    Thanks vinaypugalia