cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Values depending on date comparison

Hello,

I have a situation where depending on the date, I need to take into account one value or another. More pricesely, when rating a person, if the date is > than his promotion date I need to take into account let's say criteria 1, if not, criteria 2, and in the end, when looking at an yearly report, I will need to see the average of both criterias.

I have the following formulas:

Criteria 1 = IF(max(Calendar[Date])>[Promo_date],BLANK(),AVERAGE(Score1[Attempt Score1]))

Criteria 2 = IF(MAX(Calendar[Date])>[Promo_date],CALCULATE(average(Score2[Attempt score2]),,BLANK())

Measure = IF(MAX(Calendar[Date])<[Promo_date],[Criteria 1,[Criteria 2]))

The measure on a month-to-month logic seems to be working, but as you can see above, the yearly average is wrong, and I think it takes into account only the scenario when the condition is met for criteria 2.

The displayed average is 0.17 just like the value for December, and for this example, the promo date is indeed 1st of December, so it only took into account the values from 1st of December onwards.

Any idea how can I make it to also display correctly the yearly average ?

Thank you!

1 ACCEPTED SOLUTION
Super User

@Bratone , Try like

Averagex(values(Date[Month Year]), calculate(IF(MAX(Calendar[Date])<[Promo_date],[Criteria 1,[Criteria 2])) )

2 REPLIES 2
Super User

@Bratone , Try like

Averagex(values(Date[Month Year]), calculate(IF(MAX(Calendar[Date])<[Promo_date],[Criteria 1,[Criteria 2])) )

Helper I

Thank you so much for your fast answer, is working as it should now:

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.