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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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