Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a table over which i need to calculate average of a column grouped by multiple columns. I am able to create a table using below:
GROUPBY(tableA,tableA[groupbyA],tableA[groupbyB],"AvgColumn",AVERAGEX(CURRENTGROUP(), tableA[Column-on-which-i-need-average]))
But this table gives me a calculated column for "AvgColumn". When i use this table in dashboard, i am forced to choose an aggregation or formula which i do not need. I need a measure instead which can be used without further aggregation when showing on Power BI Dashboard.
How can i achieve this?. Is this even possible?.
Solved! Go to Solution.
Hi @sureddy1,
You can create a measure like below:
Measure = CALCULATE(AVERAGE(Table1[Amount]),FILTER(ALLSELECTED('Table1'),'Table1'[Group]=MAX('Table1'[Group]) && 'Table1'[Year]=MAX('Table1'[Year])))
You can download attached .pbix file to have a look.
Best Regards,
Qiuyun Yu
On Similar lines, i need to calculate the avg. score.
SurveyID | Parameter | SubParameter | Question | Score | ScoreatSubParameterlevel | |||||
1 | 1 | 1 | Q1 | 2.67 | 1.8 | |||||
1 | 1 | 1 | Q2 | 1 | 1.8 | |||||
When I do avg. of Score on Power BI Chart then avg score on Power BI shows 1.5 and not 1.8. Not sure why |
Please could any one help on the above scenario. Why does Power BI calculate the wrong avg. for SubParameter=1 .
Hi @sureddy1,
You can create a measure like below:
Measure = CALCULATE(AVERAGE(Table1[Amount]),FILTER(ALLSELECTED('Table1'),'Table1'[Group]=MAX('Table1'[Group]) && 'Table1'[Year]=MAX('Table1'[Year])))
You can download attached .pbix file to have a look.
Best Regards,
Qiuyun Yu
Hello,
I am trying to do something similar but can't follow the solution to apply it to my case.
I have a table of patients and clinical results (Blood pressure):
patientid date value, program status (indicates if enrolled in a specific health program)
1 1/1/18 87 inactive
1 2/1/18 80 active
I need to have a flag on each PATIENTT to indicate if the patient is active at any point during a daterange I select from a slicer. If there is even one record for the patient that has "program status" = active during the slicer range, all rows of the patient should be flagged as true. If none of the records are showing "active" for the slicer range, all rows should be false.
If I choose 1/1/18 - 1/15/18, I need to see:
patientid date value, program status ActiveInDateRange (this indicates the patient is not active during the time selected regardless if there are some rows of the patient showing active )
1 1/1/18 87 inactive false
1 2/1/18 80 active false
If I choose 1/1/18 - 3/1/18 I should see:
patientid date value, program status ActiveInDateRange (this indicates the patient IS active during the time selected regardless if threre are specific rows of the patient showing inactive )
1 1/1/18 87 inactive true
1 2/1/18 80 active true
Essentially i'm trying to say "find all rows of the patient (group by patient) where program status = true and if count > 0 then the new measure should be "true", otherwise "false".
Can you help me create this measure?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |