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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
babbles
New Member

DAX help

Hi Everyone,

 

I'm having some issues with the dax i've used. It is yielding the correct result for the row but the grand total is zero, instead of the sum of the rows. I'm still learning dax and power bi so i may not have used some of the dax functions correctly. I shared an example as an excel just protect some sensitive info and the dax used. 

 

Any help would be great!

Picture1.png

 

test _ =
VAR selecteddate = MAX(d_calendar[Date])
VAR empstart_ = SUMX(d_resource_main, SELECTEDVALUE(d_resource_main[datefrom2]))
VAR startyear_ = CALCULATE(STARTOFYEAR(d_calendar[Date]))

VAR StartValue =
    IF(
        HASONEVALUE(d_resource_main[clientResourceid2]),
        IF(
            empstart_ > startyear_,
            empstart_,
            startyear_
        )
    )

VAR empend_ = SUMX(d_resource_main, SELECTEDVALUE(d_resource_main[dateto2]))
VAR endofmonth_ = EOMONTH(selecteddate, 0)
VAR endyear_ = IF(endofmonth_ > TODAY(), TODAY(), endofmonth_)

VAR EndValue =
    IF(
        HASONEVALUE(d_resource_main[clientResourceid2]),
        IF(
            empend_ < endyear_,
            empend_,
            endyear_
        )
    )

VAR networkdays_count = NETWORKDAYS(StartValue, EndValue)

RETURN
networkdays_count
1 REPLY 1
Anonymous
Not applicable

Hi @babbles ,

 

Please try:

VAR networkdays_count = SUMX(VALUES('Table'[company]), NETWORKDAYS(StartValue, EndValue))

Why Power BI totals might seem inaccurate - SQLBI

 

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 in the Power BI Forum

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors