Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
cmcgo3
Helper I
Helper I

Power BI Dax Measure

cmcgo3_0-1692910023094.png

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....

 

cmcgo3_1-1692910023099.png

 

 

 

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 4
cmcgo3
Helper I
Helper I

I was able to resolve my problem!  Thank you!!

parry2k
Super User
Super User

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

cmcgo3
Helper I
Helper I

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!

parry2k
Super User
Super User

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.