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
shaher111
New Member

Dax Query to get last sex month for each raw

shaher111_0-1697806021651.png

I have this table , what i need to do to get new hire turn over for each month , the formula is  : ( Seperated employees within 6 months  / number of new hires within 6 months )   for seperated is good and comes calculated from the source for each raw but for new hires not calculated so i need to calculate it for each raw lined with seperated to be able to divide them  so for example for Aug we have 1 seperated and should sum of 2+6+0+5+1+3  last 6 month including Aug sor new hiire should be 17 and turnover new hir will be : 1 / 17

1 REPLY 1
_elbpower
Resolver III
Resolver III

Last 6 Months Sum Divide = 
VAR SelectedDate = MAX('YourTable'[Date])  // Get the selected date - Here you can get the current date or selected from slicer
VAR StartDate = EOMONTH(SelectedDate, -6) + 1  // Calculate the start date for the last 6 months
VAR EndDate = SelectedDate  // The selected date is the end date
RETURN
    CALCULATE(
       DIVIDE( SUM('YourTable'[Column1] ), SUM( 'YourTable'[Column2]),0),
        FILTER(
            'YourTable',
            'YourTable'[Date] >= StartDate && 'YourTable'[Date] <= EndDate
        )
    )

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.