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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count of the employees for the last 13 months logic

hi All...
i have one logic need to impliment.


1. I have snapshot date column 

2. Need employee count like month wise for the last 13 monnths 
3. Have weight values 0.5 and 1 
4. max and Min snapshot date*0.5 and remaing all months*1
5. total headcount(sum(Total Head count*Weight))
6. Avg headcount(Total headcount/ last12 months)

Anjaneyachari_0-1691401052867.png

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

(2) We can create calculated columns.

Weight = 
var _min=CALCULATE(MIN('Table'[SnapsjptDate]),ALL('Table'))
var _max=CALCULATE(MAX('Table'[SnapsjptDate]),ALL('Table'))
return IF('Table'[SnapsjptDate]=_min || 'Table'[SnapsjptDate]=_max,0.5,1)
Total Headcount * Weight = 'Table'[Count]* 'Table'[Weight]

(3)We can create measures. 

Total Headcount = SUMX(ALL('Table'),'Table'[Total Headcount * Weight])
Avg Headcount = DIVIDE([Total Headcount],12,0)

(4) Then the result is as follows.

vtangjiemsft_0-1691563862115.png

 

Best Regards,

Neeko Tang

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

View solution in original post

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

(2) We can create calculated columns.

Weight = 
var _min=CALCULATE(MIN('Table'[SnapsjptDate]),ALL('Table'))
var _max=CALCULATE(MAX('Table'[SnapsjptDate]),ALL('Table'))
return IF('Table'[SnapsjptDate]=_min || 'Table'[SnapsjptDate]=_max,0.5,1)
Total Headcount * Weight = 'Table'[Count]* 'Table'[Weight]

(3)We can create measures. 

Total Headcount = SUMX(ALL('Table'),'Table'[Total Headcount * Weight])
Avg Headcount = DIVIDE([Total Headcount],12,0)

(4) Then the result is as follows.

vtangjiemsft_0-1691563862115.png

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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