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! Learn more

Reply
hama21
Helper I
Helper I

Difference between date.[month] and date.[year]

Hello everyone,

 

I have a table in my report where I use two measures that are as follows:

 

measure c = DIVIDE((SUM('Table[Value A])*12),SUM('Table'[Value B]))

 

and measure to calculate the average of this measure c

 

average measure c = AVERAGEX ( VALUES ( Calendar[Date].[Month] ), [measure c] )

 

This is the result of my table:

dateteamvalue Avalue Bmeasure Caverage measure C
ago/21A3711,45166193908,10,02680%0,02680%
set/21A2549,991700199410,01800%0,01800%
out/21A19605,06173440583,50,13564%0,13564%
nov/21A24001,52180851849,50,15926%0,15926%
dez/21A14640,11189116781,80,09290%0,09290%
jan/22A5830,26197560129,60,03541%0,03541%
fev/22A16711,02206557220,30,09708%0,09708%
mar/22A16551,37203876476,50,09742%0,09742%
abr/22A14733,25201803932,30,08761%0,08761%
mai/22A17461,04207193959,20,10113%0,10113%
jun/22A31595,37218213661,20,17375%0,17375%
jul/22A76286,54224224552,40,40827%0,40827%
TOTAL 243676,9823390529950,12501%0,11944%

 

The result of my average of measure c in this table, using Calendar[Date].[Month] is 0,11944%. The problem is, when I change to Calendar[Date].[Year] my result is 0,11766%. Could someone please explain to me why I'm having this result change and what would be the correct one?

 

Thank you

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

@hama21 Well, the reason is that you are taking an average across either 2 rows (Year) or 12 rows (Month). It is also possible that VALUES is returning a blank row and that might also throw some things off. I think that your formula would be much more clear and more flexible if you did not use the auto-time intelligence stuff which has the potential to cause issues as well as use SUMMARIZE or DISTINCT versus VALUES. Seriously, don't use VALUES: https://youtu.be/vOUdKXZpmSc

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

How do you recommend my formula? I'm watching the video right now. Thanks for the answer @Greg_Deckler 

@hama21 I would need a better sense of your source data to be 100% sure. Is what you posted a good example of how your source data looks? But, I would personally try to do something along the lines of:

Average Measure =
  VAR __Table =
    SUMMARIZE(
      ADDCOLUMNS(
        'Table',
        "__Month",MONTH('Table'[Date])
      ),
      [__Month],
      "__Measure",[measure c]
    )
RETURN
  AVERAGEX(__Table,[__Measure])

A little more verbose because I don't know if you have a Month column already. The advantages of this approach is that you can troubleshoot it by using CONCATENATEX instead of AVERAGEX to inspect your table values within the calculation itself. Also, this method removes any issues that might be caused via table configuration. This form works in a single table data model as well as a star, schema, etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler It's working but I received different value when using .[month] or .[year]. I want to understand why this is happening because the value must be the same

@hama21 Ah, turns out that it is a measures total problem. I attached a PBIX that demonstrates how to get the same total for both .[Month] and .[Year] below signature.

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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