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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mehmet_93
Frequent Visitor

Calculate Values Seperately For Each Year

Hi guys,

 

I have values for 2019,2020,2021 and 2022 years. I want to calculate monthly and cumulative average for per year but the years are seperately each other. Is there a Dax formula for this? In a one table, I wanna calculate just 2019 or 2020 or 2021 or 2022. For cumulative, I have tried following formula but when i filter with year, It doesn't calculate just the filtered year, It only shows values of filtered yar.

 

Kümülatif Setup Hariç Ortalama Üretim Adeti = CALCULATE(AVERAGE('2022 H4'[Üretim Adeti]),FILTER(ALL('2022 H4'),'2022 H4'[TARİH] <= MAX('2022 H4'[TARİH])),'2022 H4'[SETUP] <> "S")

 

Thank you.

1 ACCEPTED SOLUTION
mehmet_93
Frequent Visitor

Hi guys, I have just changed ALL() function to ALLSELECTED() function, and it's worked.

 

Kümülatif Setup Hariç Ortalama Üretim Adeti = CALCULATE(AVERAGE('2022 H4'[Üretim Adeti]),FILTER(ALLSELECTED('2022 H4'),'2022 H4'[TARİH] <= MAX('2022 H4'[TARİH])),'2022 H4'[SETUP] <> "S")

View solution in original post

3 REPLIES 3
mehmet_93
Frequent Visitor

Hi guys, I have just changed ALL() function to ALLSELECTED() function, and it's worked.

 

Kümülatif Setup Hariç Ortalama Üretim Adeti = CALCULATE(AVERAGE('2022 H4'[Üretim Adeti]),FILTER(ALLSELECTED('2022 H4'),'2022 H4'[TARİH] <= MAX('2022 H4'[TARİH])),'2022 H4'[SETUP] <> "S")

Syk
Super User
Super User

You can use the DatesBetween function to get the a specific year, for example this would return only 2019 (copied from your formula)

 

Kümülatif Setup Hariç Ortalama Üretim Adeti = CALCULATE(AVERAGE('2022 H4'[Üretim Adeti]),DatesBetween(Table[Date],"1/1/2019","12/31/2019"))

 

 

mehmet_93
Frequent Visitor

I have tried as your suggestion. But in graph, it shows values month by month. I wanna show values cumulative month by month with another line. What kind of DAX formula would I use?

 

Graph.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.