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

Anonymous
Not applicable

## how to find (current year + last year )/2

Hello Experts ,

how to find (current year + last year )/2

I have a dax for last year(please find below dax) but i want to do (current year + last year )/2.How to find current year and last year .please advise me or share me dax .

# cum_last = var p1 = CALCULATE(COUNT(HRMS[EmpID]),FILTER(ALL(HRMS),[Termd] = 0))-1
VAR _selectedYear = SELECTEDVALUE('Calendar'[Date].[Year])-1
var p2 = CALCULATE(DISTINCTCOUNT(HRMS[EmpId]),FILTER(ALL(HRMS),[Termd]=0 && YEAR('HRMS'[DateofHire])<=_selectedYear) )

var result = IF(_selectedYear = 0 , p1 ,p2)
return result + 0

2 REPLIES 2
Community Support

Hi @Anonymous

Is this problem sloved?
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please feel free to let me know.

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User

Hi. First of all you need to be sure you have a Calendar table to manage Time Intelligence.  Create two measures:

Then you can find this year :

``CALCULATE( COUNT ( Table[column] ) )``

Calculation for last year:

``CALCULATE( COUNT ( Table[column] ) , SAMEPERIODLASTYEAR (CalentarTable[DateColumn]) )``

Then you can create a third measure and use DIVIDE function to do the last part.

You can find how to create a Calendar Table here

Hope this helps,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

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.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors