The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I would like to create a card from my table called 'Debt' that provides the median debt per student [Id] per program [Program]. I have the used the following calcuation to do it per student, but I cannot figure out how to add the additional element of per program. We have several students at our institution who graduate from one program and enroll in another.
MEDIANX (
KEEPFILTERS(VALUES('Debt' [Id])).
CALCULATE(SUM('Debt' [Total])))
Thank you in advance for any insight.
Oh, you want only a card / one measure per both categories. Try this:
You have to create a virtual table with the sum values and than you can do the medianx
Measure =
Var __table = SUMMARIZE(Debt,Debt[ID],Debt[Programm],"__sum",sum(Debt[Total]))
RETURN MEDIANX(__table,[__sum])
Proud to be a Super User!
HI,
i try this with the raw data (left) and right the matrix with the median measure:
The median will calculated within the groups.
The measure:
Measure = MEDIANX(Debt,Debt[Total])
Proud to be a Super User!
Here is a example in the end of the article where two filters are used in keepfilters:
https://www.sqlbi.com/articles/using-keepfilters-in-dax/
Proud to be a Super User!
Thanks. That makes sense when trying to get calcuate the sum, but I still cannot figure out how to do it when I need the median of the sum for 2 filters/categories.
User | Count |
---|---|
10 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
20 | |
15 | |
14 | |
10 | |
7 |