Forum Discussion
Difference between date.[month] and date.[year]
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.
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
- Greg_Deckler3 years ago
Community Champion
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