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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Time function

Hello to all,

I am writing to you regarding a DAX request:

I have a table calculating the average electricity production according to a chosen period. This table is synchronized with two segments (Years and months) that allow me to choose the period I want to analyze.
What I would like to do is to add a column to this table that would calculate the average production of the current year (Year N). This would allow me to compare in the same table the values of previous years with the values of the current year.
The problem is that my segments take over my DAX query even when using an ALL function. Here is my query:

Moyenne corrigée année N (MWh) =
"AVERAGEX(
SUMMARIZE(
VALUES(Dates[Année]),
Dates[Année],
"E prod",
CALCULATE(SUM(fact_production[Energie produite (kWh)])/1000,fact_production[est_representatif]=TRUE(),YEAR(Dates[Année])=YEAR(TODAY()))
),
[E prod]
)"

As you can see below, I did not select the year 2021 so no result is displayed

image.png

If it helps, I have a relationship between a column in my date table and a column in my production table where the electricity production values are:

image.png

Thanks in advance for your help,

Have a nice day

Joël

 

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Is Moyenne corrigée periode (MWh) a measure that calculates what you want but for the selected time period instead of this year?

If so, does this work (where 'Year Column' is whatever you've used in the Periode prise en compte slicer) ?

 

Moyenne corrigée année N (MWh) =

CALCULATE(

[Moyenne corrigée periode (MWh)],

Dates[Year Column]=YEAR(TODAY())

)

View solution in original post

2 REPLIES 2
PaulOlding
Solution Sage
Solution Sage

Is Moyenne corrigée periode (MWh) a measure that calculates what you want but for the selected time period instead of this year?

If so, does this work (where 'Year Column' is whatever you've used in the Periode prise en compte slicer) ?

 

Moyenne corrigée année N (MWh) =

CALCULATE(

[Moyenne corrigée periode (MWh)],

Dates[Year Column]=YEAR(TODAY())

)

Anonymous
Not applicable

Hello

Indeed it works, thank you very much @PaulOlding ! Sometimes you don't have to look too hard! ahahah

 

Have a nice day and thanks again

 

Bye

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.