cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lutho
Helper II
Helper II

Advise on best approach -

I all, I am looking fo some guidance on best practice.

I am creating a student dashboard. I have a big data table that contains data from an annual student test covering multiple years. I can select a student via basic slicer and diplay current subjects and the series of  annual scores.

However I need to show student performance in the context of the other students for that year either as a box or violin plot (ie. Year 5 student vs all Year 5 students in 2013, Year 6 student vs all year 6 students in 2014 etc). The slicer reduces the data set to just the student so the box/violin ends up with one data point.

I can easily create an alternate table using SQL but it seems so wrong to not do this in PBI. What would be the best practice approach? I just need a pointer and can run with it from there.

Thanks in advance.

1 ACCEPTED SOLUTION
westwrightj
Resolver III
Resolver III

Hey @lutho 

 

  As @amitchandak  mentioned it would be best to have some sample data and a sample output to answer this question.

 

Without this, here is some sample data I have included to try and meet your solution

 

westwrightj_0-1605207343644.png

 

Also I've gone ahead and duplicate this table in the query editor and paried it down just to unique Student-Year combinations

westwrightj_1-1605209055596.png

 

The tables are connected by year and one filters the other in a one way many to many relationship

 

westwrightj_2-1605209080295.png

 

Now we can write a measure like this

 

Students From Same Year as Selected = 

var TheStudent = VALUES('Test Data (2)'[Student])

var TheYear = CALCULATE(MAX('Test Data'[Year]), 'Test Data'[Student] in TheStudent)

return

CALCULATE(MAX('Test Data'[Score]), 'Test Data'[Year] = TheYear)

 

This will allow us to make a violin chart that will adjust based on the year of our selected student

 

westwrightj_3-1605209158882.png

 

westwrightj_4-1605209168404.png

 

If you wanted to also see the selected student's score you could add a card with this measure

 

Student Score = 

var TheSelectedStudent = SELECTEDVALUE('Test Data (2)'[Student])

return

CALCULATE(MAX('Test Data'[Score]), 'Test Data'[Student] = TheSelectedStudent)

westwrightj_5-1605209261538.png

 

 

 

westwrightj_6-1605209271142.png

 

 

Let me know if this helps or if you were looking for different functionality.

 

 

View solution in original post

2 REPLIES 2
westwrightj
Resolver III
Resolver III

Hey @lutho 

 

  As @amitchandak  mentioned it would be best to have some sample data and a sample output to answer this question.

 

Without this, here is some sample data I have included to try and meet your solution

 

westwrightj_0-1605207343644.png

 

Also I've gone ahead and duplicate this table in the query editor and paried it down just to unique Student-Year combinations

westwrightj_1-1605209055596.png

 

The tables are connected by year and one filters the other in a one way many to many relationship

 

westwrightj_2-1605209080295.png

 

Now we can write a measure like this

 

Students From Same Year as Selected = 

var TheStudent = VALUES('Test Data (2)'[Student])

var TheYear = CALCULATE(MAX('Test Data'[Year]), 'Test Data'[Student] in TheStudent)

return

CALCULATE(MAX('Test Data'[Score]), 'Test Data'[Year] = TheYear)

 

This will allow us to make a violin chart that will adjust based on the year of our selected student

 

westwrightj_3-1605209158882.png

 

westwrightj_4-1605209168404.png

 

If you wanted to also see the selected student's score you could add a card with this measure

 

Student Score = 

var TheSelectedStudent = SELECTEDVALUE('Test Data (2)'[Student])

return

CALCULATE(MAX('Test Data'[Score]), 'Test Data'[Student] = TheSelectedStudent)

westwrightj_5-1605209261538.png

 

 

 

westwrightj_6-1605209271142.png

 

 

Let me know if this helps or if you were looking for different functionality.

 

 

amitchandak
Super User
Super User

@lutho ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

Power BI Dev Camp Session 25 with aka link 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, August 25 at 11a PDT for a great session with Ted Pattison!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors