Forum Discussion

cmcgo3's avatar
cmcgo3
Helper II
3 years ago

Power BI Dax Measure

I also wanted to add a table underneath that would give you totals.  For this example, Total Students 20, Count of automobile I would want 3 and then percentage of total ...20 students / 3 chevrolet .15 or 15%.  Any help would be greatly appreciated !!

 

I am trying to add another feature; having some challenges with creating a measure....

 

 

 

 

Flag =

var _count=COUNTX(ALLSELECTED('Scores'),'Scores'[name])

var _per=_count*0.30

var _rank=RANKX(ALLSELECTED('Scores'),CALCULATE(SUM('Scores'[score])),,DESC)

return

IF(

    _rank<=_per,1,0)

 

Total Students = COUNTROWS(FILTER('Scores','Scores'[Flag]=1))

 The output for total students is 20; which is correct.

 

How would I write a measure that would capture what type of automobile a student drives based on the filtered total of 20.  For example, of those 20 students, 3 students have "Chevrolet" as automobile.  What measure would you write to get a total of 3?

 

I have been "stuck" on trying to create this calculation.

 

Best Regards,

 

Chris C.

 

 

 

 

4 Replies

  • cmcgo3 your screenshots are so hard to read, can you share sample data and what you are trying to achieve? 

  • Thanks for your reply!  For example, with two filters; the city Philadelphia for week 1, data shows 17 students; which is correct..  The 17 students represents 25% of the entire student population. I want bottom box to show 17 students and 3 "count of automobile" if filter for Chevrolet is selected.   It gets tricky for me when trying to get calculations with multiple filters selected.  I appreciate any help!

  • cmcgo3 sorry still not clear, better to share a sample pbix file with the expected output.