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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sgv2000
Frequent Visitor

Average of Calculation

I have what I think is a difficult request.  We need to average calculations.  Normally I would sum the base numbers the divide them out to get the total for any given period.  In this case, that does not actually work.  I need to sum the values to a given month, calculation a number then average that number over a year and display the result back on every month in that year so that it makes a straight line for the year then shifts for the next year. 

 

Here is some data:

fiscalyearsnapshotdatekeyGroup A B
201920180924P1 $      278,848.04$4,488,189.24
201920181029P1 $      314,841.33$6,477,121.20
201920181126P1 $      309,689.75$6,716,298.99
201920181231P1 $      411,515.40$8,887,870.01
201920190128P1 $      457,607.73$7,708,110.00
201920190225P1 $      469,853.25$6,529,844.70
201920190325P1 $      483,040.16$7,316,726.42
201920190429P1 $      532,521.67$8,871,548.88
201920190527P1 $      488,893.50$8,709,589.21
201920190624P1 $      370,846.40$9,130,070.90
201920190729P1 $      316,385.76$8,639,870.17
201920190826P1 $      277,852.89$6,775,670.11
202020190930P1 $      206,350.87$7,407,926.56
202020191028P1 $      168,217.30$6,296,450.38
202020191125P1 $      128,043.85$4,695,644.48
202020191230P1 $      137,252.77$6,533,805.23
202020200127P1 $      141,225.38$5,181,490.87
202020200224P1 $      115,903.77$3,595,357.29
202020200330P1 $      162,153.56$4,935,011.97
202020200427P1 $      163,697.04$4,113,838.07
202020200525P1 $      146,603.43$2,695,020.73
202020200629P1 $      148,181.73$4,015,751.93
202020200727P1 $      109,965.43$3,313,957.44
202020200803P1 $      102,650.46$2,901,466.65
201920180924P2 $  1,833,892.58$24,782,303.00
201920181029P2 $  1,308,628.59$24,446,044.97
201920181126P2 $      614,329.80$16,365,929.97
201920181231P2 $      787,822.44$17,958,706.00
201920190128P2 $      905,548.97$12,994,856.05
201920190225P2 $      281,210.11$3,378,642.30
201920190325P2 $      339,094.48$5,724,809.81
201920190429P2 $      335,269.92$3,476,134.18
201920190527P2 $      674,804.58$4,794,038.25
201920190624P2 $  1,905,069.16$8,024,551.28
201920190729P2 $  1,705,701.75$12,783,285.09
201920190826P2 $  2,257,869.43$13,595,708.62
202020190930P2 $  1,768,804.75$21,888,151.78
202020191028P2 $  1,505,156.89$20,065,604.62
202020191125P2 $  1,142,695.30$21,747,013.37
202020191230P2 $  1,016,565.63$16,328,356.58
202020200127P2 $  1,475,249.14$19,385,685.16
202020200224P2 $  3,230,211.51$21,305,733.15
202020200330P2 $  3,240,043.33$27,947,612.44
202020200427P2 $  1,116,678.26$14,564,844.67
202020200525P2 $  1,863,047.40$12,153,308.15
202020200629P2 $  1,584,257.23$15,218,155.79
202020200727P2 $  2,106,581.48$24,287,245.79
202020200803P2 $  2,860,393.34$23,419,627.99

 

1 ACCEPTED SOLUTION

@sgv2000 , Try like

calculate(averageX(values(Table[snapshotdatekey]), divide(Table[B],Table[A])), all(Table))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
sgv2000
Frequent Visitor

Here is the result I am looking for:

Calculation for DOS = B/A

fiscalyearsnapshotdatekey A B DOS Average DOSYearly Average
201920180924 $  2,112,740.62$29,270,492.24        13.85        13.85        14.71
201920181029 $  1,623,469.92$30,923,166.16        19.05        19.05        14.71
201920181126 $      924,019.55$23,082,228.95        24.98        24.98        14.71
201920181231 $  1,199,337.83$26,846,576.01        22.38        22.38        14.71
201920190128 $  1,363,156.69$20,702,966.05        15.19        15.19        14.71
201920190225 $      751,063.36$9,908,487.00        13.19        13.19        14.71
201920190325 $      822,134.63$13,041,536.23        15.86        15.86        14.71
201920190429 $      867,791.59$12,347,683.07        14.23        14.23        14.71
201920190527 $  1,163,698.08$13,503,627.47        11.60        11.60        14.71
201920190624 $  2,275,915.56$17,154,622.18          7.54          7.54        14.71
201920190729 $  2,022,087.51$21,423,155.26        10.59        10.59        14.71
201920190826 $  2,535,722.32$20,371,378.73          8.03          8.03        14.71
202020190930 $  1,975,155.62$29,296,078.34        14.83        14.83        13.16
202020191028 $  1,673,374.19$26,362,054.99        15.75        15.75        13.16
202020191125 $  1,270,739.15$26,442,657.85        20.81        20.81        13.16
202020191230 $  1,153,818.40$22,862,161.81        19.81        19.81        13.16
202020200127 $  1,616,474.53$24,567,176.03        15.20        15.20        13.16
202020200224 $  3,346,115.28$24,901,090.43          7.44          7.44        13.16
202020200330 $  3,402,196.89$32,882,624.41          9.67          9.67        13.16
202020200427 $  1,280,375.31$18,678,682.74        14.59        14.59        13.16
202020200525 $  2,009,650.83$14,848,328.88          7.39          7.39        13.16
202020200629 $  1,732,438.96$19,233,907.72        11.10        11.10        13.16
202020200727 $  2,216,546.90$27,601,203.23        12.45        12.45        13.16
202020200803 $  2,963,043.80$26,321,094.63          8.88          8.88        13.16
             13.93 

@sgv2000 , Try like

calculate(averageX(values(Table[snapshotdatekey]), divide(Table[B],Table[A])), all(Table))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak , this put me on the right path.  I will mark this as the solution.  It took a little playing with the filter condition to get it.

CALCULATE(AVERAGEX(VALUES(Table[snapshotdatekey]),divide(Table[B],Table[A]))),FILTER(ALLSELECTED(Table),Table[fiscalyear]=max(Table[fiscalyear])))
Anonymous
Not applicable

Yeah... That's all very good and well but it would be even better if you could explain in plain English how calculations are performed. Your description above is not absolutely clear. On the other hand, figuring this out from your tables is not something anyone would have time to do. Please explain the calculations in the second table. Thanks.

@Anonymous , Sure.  If you pull the data from the original table into Power BI then put the values into a grid, doing nothing but letting it sum, you will get fiscalyear, snapshotdatekey, a and b.  A and B are just sums.  DOS is A/B, as explained.  Average DOS is just that.  It is the average of the DOS column.  So on a given week it matches.  The total for that column is the actual average of the DOS numbers.  The last column is the most difficult. It is the average of the DOS values for a fiscslyear repeated on every row for that year.  Hope that helps.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.