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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Surekha_PM
Helper III
Helper III

Average of a column based on criteria

Hello,

 

I am trying to perform the AVERAGEIFS function logic which we use in excel in PowerBI. I have one calendar date table which has unique date. Another table has duplicate date; basically, a single date has multiple category. Now, I want to know the average of the values of the dates in the category table for each date. For example, see below:

Table A (Calendar Date)

1-May-24
2-May-24
3-May-24
4-May-24
5-May-24
6-May-24
7-May-24
8-May-24
9-May-24
10-May-24


Table B;

dayCategoryValue
1-May-24A100
1-May-24B0
1-May-24C0
1-May-24D100
1-May-24E100
2-May-24A100
2-May-24B100
2-May-24C100
2-May-24D100
3-May-24A100
4-May-24A100
5-May-24A100
6-May-24A100
7-May-24A100
8-May-24A100
9-May-24A100
10-May-24A100


Once I do the average I will do the sum of values column (after doing average) and divide it by number of days.

Can anyone suggest please.

Thanks & Regards,
Surekha

2 REPLIES 2
jgeddes
Super User
Super User

If you are looking for a result like the following...

jgeddes_0-1717083509904.png

You can create the following measures.

Category Average = 
var _vTable = 
SUMMARIZE(
    'Table',
    'Table'[Category],
    "_average", AVERAGE('Table'[Value])
)
RETURN
SUMX(
    _vTable,
    [_average]
)
Count of Days = 
CALCULATE(
    DISTINCTCOUNT('Table'[day]),
    ALL('Table')
)
avg per day = 
DIVIDE(
    [Category Average],
    [Count of Days],
    0
)

If you are looking for a different result please give an example of your desired output.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi Jgeddes,

I tried this function but it is not given me any result. It is shwing blank. Any other way to solve this?

Regards,
Surekha

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors