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

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.

Reply
cferrer
Frequent Visitor

Getting a YTD Average from Computed Monthly Scores

Hi!

 

I am trying to get the YTD average after I get the monthly computed scores.

 

To illustrate:

 

Below is the raw data table:

 

 

response IDMonthCategoryBusiness
1Jun-171A
2Jun-171C
3Jun-171B
4Jun-172C
5Jun-173A
6Jun-172A
7Jun-173B
8Jun-172C
9Jun-172A
10Jun-173A
11Jun-172B
12Jun-171A
13Jun-171A
14Jun-171A
15Jun-171A
16Jun-172B
17Jun-173C
18Jun-171A
19Jun-172A
20Jun-173B
21Jun-171A
22Jun-171C
23Jul-171B
24Jul-172C
25Jul-173A
26Jul-172A
27Jul-173B
28Jul-172C
29Jul-172A
30Jul-173A
31Jul-172B
32Jul-171A
33Jul-171A
34Jul-171A
35Jul-171A
36Jul-172B
37Jul-173C
38Jul-171A
39Jul-172A
40Jul-173B

 

I'd like to compute it like so, grouping the responses by Month and Business, counting each response that is under Category 1, 2, 3. From there computing the Score as (Category 3 - Category 1) / Grand Total * 100. And then getting the average per Business.

 

I tried using Summarize and AverageX but kept getting multiple values/scalar value error messages.

 

Count of response ID Category       
MonthBusiness123Grand TotalScore ( ([3] - [1]) / Grand Total * 100 )
Jun-17A73212-           41.67   
Jun-17B1225             20.00   
Jun-17C2215-           20.00   
Jul-17A53210-           30.00   
Jul-17B1225             20.00   
Jul-17C 213             33.33   
          
          
    AverageA-           35.83   
     B             20.00   
     C               6.67   
    [Average Score if A / B / C]   
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Here is the calculated field formula i used.  You may download my file from here.

 

=AVERAGEX(SUMMARIZE('Calendar','Calendar'[Year],'Calendar'[Month],"ABCD",(CALCULATE(COUNTROWS(Data),Data[Category]=3)-CALCULATE(COUNTROWS(Data),Data[Category]=1))/COUNTROWS(Data)),[ABCD])

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

Here is the calculated field formula i used.  You may download my file from here.

 

=AVERAGEX(SUMMARIZE('Calendar','Calendar'[Year],'Calendar'[Month],"ABCD",(CALCULATE(COUNTROWS(Data),Data[Category]=3)-CALCULATE(COUNTROWS(Data),Data[Category]=1))/COUNTROWS(Data)),[ABCD])

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks, Ashish_Mathur! This helps, is there a way to make a measure that just returns the -14.14% instead of doing it through a table? 🙂

Hi @cferrer,

 

Drag this measure into card visual and it will show the summarized result.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
cferrer
Frequent Visitor

response ID Month Category Business 1 Jun-17 1 A 2 Jun-17 1 C 3 Jun-17 1 B 4 Jun-17 2 C 5 Jun-17 3 A 6 Jun-17 2 A 7 Jun-17 3 B 8 Jun-17 2 C 9 Jun-17 2 A 10 Jun-17 3 A 11 Jun-17 2 B 12 Jun-17 1 A 13 Jun-17 1 A 14 Jun-17 1 A 15 Jun-17 1 A 16 Jun-17 2 B 17 Jun-17 3 C 18 Jun-17 1 A 19 Jun-17 2 A 20 Jun-17 3 B 21 Jun-17 1 A 22 Jun-17 1 C 23 Jul-17 1 B 24 Jul-17 2 C 25 Jul-17 3 A 26 Jul-17 2 A 27 Jul-17 3 B 28 Jul-17 2 C 29 Jul-17 2 A 30 Jul-17 3 A 31 Jul-17 2 B 32 Jul-17 1 A 33 Jul-17 1 A 34 Jul-17 1 A 35 Jul-17 1 A 36 Jul-17 2 B 37 Jul-17 3 C 38 Jul-17 1 A 39 Jul-17 2 A 40 Jul-17 3 B

Hi,

 

Your data is not clear.  Paste the data in a proper Table format and also show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.