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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Analitika
Post Prodigy
Post Prodigy

Wrong average calculation per date filter selection in Power BI

Hello,

 

I am calculating average of sum per period.

 

In visual I see this:

Analitika_0-1655303522177.png

Analitika_1-1655303538649.png

Two visuals and averages match, that correct. But when I select for example other case, for example,

Analitika_2-1655303599911.png

 Average 670.51

And in another visual is:

Analitika_3-1655303634422.png

So seems that averages don't match in this case. One assumption that average becomes wrong when period is not full year, like several months, etc.

Average in table is getting like this:

Bendra kaina_men vidurkis_new_ar_objektine =
DIVIDE(
[amount],[selected_month])
 
selected_month=
Pasirinkta menesiu =

SWITCH(
TRUE(),
ISFILTERED(_Date[Date].[Month]), IF(QUOTIENT(COUNT(_Date[Date].[Month]),30)=0,1,QUOTIENT(COUNT(_Date[Date].[Month]),30)),
IF(QUOTIENT(COUNT(_Date[Date].[Month]),30)=0,1,QUOTIENT(COUNT(_Date[Date].[Month]),30))
)
 
 
Analitika_4-1655303809853.png

Date filter.

 

 

So how to solve my issue?

 
 

 

 

8 REPLIES 8
Anonymous
Not applicable

@Analitika , in your measure, you have this:

 _Date[Date].[Month]

What is the ".[Month]" part? When I use this in a measure, I get an error. Do you have a date hierarchy set up on your _Date.[Date] field?

Anonymous
Not applicable

@Analitika , Do both the Chart visual and the Table visual use the same measure for the Average?

Do both the Chart visual and the Table visual have the same filters?

Yes date hierarchy created. Red line in visual is getting by average function. second visual use measure. Filters are same.

 

Average in first visual 

Analitika_0-1655357701673.png

 

Anonymous
Not applicable

@Analitika , In the Chart visual the Average is 670.51. The chart is showing only eight months. If you multiply 670.51 by 8 you get a total amount of 5364.08.

If you divide 5364.08 by 12 you get 447.01, which is the average in the Table visual.

So it looks like your data only has values for 8 out of the 12 months, and the Chart Average function is averaging over only those 8 months. 

Your measure [selected month] is counting all the months in the slicer selected regardless if there is any Amound data for those months.

I would guess that in the first example where both visuals show the same average of 299.82 then there is Amount data for each of the 12 months.

I would suggest that you create a measure that gives you the desired output in all cases, and then use that measure in both the Chart and Table visuals.

 

Ok, so how to fix my measure, I have no idea. I also changed measure to this measure:

DIVIDE([sum], DISTINCTCOUNT('_Date'[Month])), but it didn't work.
Anonymous
Not applicable

@Analitika , try changing the measure to DISTINCTCOUNT the month field from the table where the [sum] data comes from instead of the _Date table.

Yes, I made distinctcount(date[month]) but getting wrong if I select two or more years in date slicer.

Anonymous
Not applicable

@Analitika , could you please post the DAX for the [sum] measure?

And what is the field in the fact table that has a relationship to the -Date table?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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