Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216047

Rankings using DAX

$
0
0

Hello ,

My Data and implementation:

Schoolid           No. of Student           StudentGroup
---------------------------------------------------------
S1                            10                                  0-10
S2                             11                                11-20
S3                             20                                11-20
S4                             21                                21-30
S4                             35                                31-40

(Higher the count, top on rankings)

 

Now 'StudentGroup' stands for , group of student classified on number of students as below


-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

What i require?

 

What i want to find is rank of schools on the basis of No. of Student within the 'StudentGroup' in which particular School is falling in (refer above table).
"I wnat a rank of S2 as per No.of students within StudentGroup 11-20"

 

-I have created below DAX formula to get this value

 

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

In the above formula what i am doing is :
1.Filtering Student on the basis of StudentGroup of selected Schoolid
2.Calculating ranking on the table return by first "FILTER"
3.Getting selected shool from the table return by second "FILTER"

 

But from msdn what i found is that , "ADDCOLUMNS" wont work with RANK.EQ.

 

I want to calculate ranking on the table which i am getting on the fly using FILTER.


Is there any other alternative to resolve above requirement. Please guide for the same.

 

Thanks


Viewing all articles
Browse latest Browse all 216047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>