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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
FGLacorte
New Member

Excel Formula to DAX

Hi all, need assistance how to do this excel formula to DAX. Basically i want to forecast my headcount until year-end by adding the latest actual headcount (is July) on number to hire from August to December, as shown below.

 

FGLacorte_0-1658743051686.png

Thanks,

4 REPLIES 4
Anonymous
Not applicable

Hi @FGLacorte ,

 

Please new a calculated column:

Forecast =
VAR _month =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Actual Headcount] <> BLANK () )
    )
VAR _actual_max =
    CALCULATE (
        MAX ( 'Table'[Actual Headcount] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = _month )
    )
VAR _result =
    IF (
        'Table'[Actual Headcount] = BLANK (),
        SUMX (
            FILTER ( 'Table', 'Table'[Date] <= EARLIER ( 'Table'[Date] ) ),
            'Table'[To Hire]
        ) + _actual_max
    )
RETURN
    _result

vcgaomsft_0-1659957450243.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

SpartaBI
Community Champion
Community Champion

@FGLacorte it depends how you want to present it, in a calculated column or in measure in a visual. Need more details on your specific scenario.
Can you share a sample file and write how and where you want to show the result?

I have a matrix table for that, as below. But i am failing to get the correct formula in forecast. All of them are measures.

FGLacorte_0-1658745117877.png

 

@FGLacorte it will be something like that but to give you the exact syntax either you share the file or do a zoom with me:

 

 

Forecast = 
VAR _current_date = MAX('Table'[Date])
VAR _latest_actual_date = MAXX(FILTER(ALL('Table'), 'Table'[Actual Headcount] <> BLANK()),'Table'[Date])
VAR _latest_actual = CALCULATE(SUM('Table'[Actual Headcount]), 'Table'[Date] = _latest_actual_date, REMOVEFILTERS('Table'))
VAR _result = 
	SWITCH(
		TRUE(),
		_current_date <= _latest_actual_date, CALCULATE(SUM('Table'[Actual Headcount])),
		_latest_actual + CALCULATE(SUM('Table'[To Hire))
	)
RETURN
	_result

 

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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