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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
shaher111
Regular Visitor

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 ACCEPTED SOLUTION
_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
        )
    )

View solution in original post

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.