Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
I want to show a student's login activity per day (Event_Type = "Login") as columns and I want to show the course average for the course that the student is on as the line on the same graph.
Here is the data: https://www.dropbox.com/scl/fi/70aa2cgr1chegmrdlitdg/exampledata.xlsx?rlkey=2m5ox5ix7v65v5dsf3usl4e8...
What measure do I need for the line?
My measure for the columns is as follows:
My data is structured as follows and note that this table contains several students and several courses:
How do I create a measure that says take the course of the student selected and calculate the average logins for that course and plot on the same visual?
The expected result is that when you selected Nina who is studing Geology, the line and column chart will show Nina's logins every month as columns and plot the average logins for Geology on the line.
Solved! Go to Solution.
In the Allexcepted put the column date that your are using in the charte.
Allexcepted will remove all filter on that table except on the column you mention, so I think it Could solve your problem.
Try...
Proud to be a Super User!
Hi @cw900,
Please try this Dax measure:
AverageCourse =
AVERAGEX(
ALL(T_Logins[Student]),
CALCULATE(
AVERAGE(T_Logins[Total])
)
)
T_Logins is my table, so you need to change this to your table name. I did some test from my side and it's working fine.
Proud to be a Super User!
Hi
I don't think I was clear in my question. There are different courses in this table. Using that measure the average line is the same for every student because it is not taking into account the course that they are on.
Please provide one example with some data and the expected output.
I think that way would be easy to underdtand
Proud to be a Super User!
Here's the data:
Expected result is that when you selected Nina who is studing Geology, the line and column chart will show Nina's logins every month as columns and plot the average logins for Geology on the line.
Please take a look it this is what you're looking for:
My AverageCourse measure it this:
AverageCourse =
IF(
NOT(ISBLANK([Count of Logins])),
CALCULATE(
[SimpleAvg],
FILTER(
ALL(T_Logins),
T_Logins[Event_Type]="Login" && T_Logins[Student_Course_Name] IN VALUES(T_Logins[Student_Course_Name])
)
)
)
Proud to be a Super User!
What is
[SimpleAvg]
?
Also, that doesn't look right because the average value doesn't change each day. I need average value for the course on each day, so it will change every day.
@cw900,
See if this solve your problem:
Measures:
SimpleAvg =
AVERAGE (T_Logins[Total])
New Avg =
IF(
NOT(ISBLANK([Count of Logins])),
CALCULATE(
[SimpleAvg],
REMOVEFILTERS(T_Logins[Student]),
T_Logins[Event_Type]="Login"
)
)
Proud to be a Super User!
Ok that is much closer. I changed the measure to this:
Try something using Allexcepted.
DAX is all about context and for that reason is important to have the right example.
In my example is working fine on my side...
Proud to be a Super User!
Hmmm. ALLEXCEPT looks useful but I'm struggling to work out the implementation.
The following measure just gives me the same average on each date.
In the Allexcepted put the column date that your are using in the charte.
Allexcepted will remove all filter on that table except on the column you mention, so I think it Could solve your problem.
Try...
Proud to be a Super User!
That was it 🙂
Thank you.
Great. You're welcome.
Proud to be a Super User!
Hi @cw900
A simple avg formula is total sum / no of count.
Create same formula through measure.
Add your formula here in this property of bar chart
I hope I answered your question!
How do I identify the course that the student is on? And how to I tell my measure for the average to ignore the student that I've selected and get me the average for the course they are on?
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
102 | |
68 | |
45 | |
37 | |
36 |