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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
DRA885
Frequent Visitor

MEDIANX missing values for dates with no data

Hello all.

 

I'm looking for some help on this DAX code:

 

 

Median Test 3 (next 3 months approved) = 
VAR MedianValueDiscipline =
    CALCULATE (
        MEDIANX (
            SUMMARIZE (
                'Actual & Forecast Project Resources',
                'Actual & Forecast Project Resources'[Work Week Ending Date],
                'Actual & Forecast Project Resources'[Capsule Descriptions.Discipline],
                "Median FTEs",
                    SUMX (
                        'Actual & Forecast Project Resources',
                        'Actual & Forecast Project Resources'[Consolidated FTEs]
                    )
            ),
            [Median FTEs]
        ),
        'Actual & Forecast Project Resources'[Final Consolidated Hours Type] = "Approved",
        DATESINPERIOD (
            'Actual & Forecast Project Resources'[Work Week Ending Date],
            MAX ( 'Date'[EndOfThisWeek] ) - 1,
            3,
            MONTH
        )
    )
RETURN
    MedianValueDiscipline

 

 

 
This is producing the following results in a matrix:
Median - next 3 months.png
Whilst this is giving the correct total value, the rows with null values are incorrect as the Median is only calculating for dates where there is a value. The rows with 'blanks' are from the field 'Actual & Forecast Project Resources'[Capsule Descriptions.Level Category]
 
My question is, how can I force zero values into the 'blanks' and obtain the correct result for each row of the matrix?
 
TIA, Ian
3 REPLIES 3
Anonymous
Not applicable

@DRA885 , did you manage to solve this? I am currently fasing the same problem.

DRA885
Frequent Visitor

Sorry thought I had the solution but this is still incorrect.
Obviously now still looking for a solution to this

DRA885
Frequent Visitor

solved with the following change to the Sum calculation of FTEs:

Median Test 3 (next 3 months approved) =
VAR MedianValueDiscipline =
    CALCULATE (
        MEDIANX (
            SUMMARIZE (
                'Actual & Forecast Project Resources',
                'Actual & Forecast Project Resources'[Work Week Ending Date],
                'Actual & Forecast Project Resources'[Capsule Descriptions.Discipline],
                "Median FTEs",
                    IF (
                        CALCULATE (
                            SUM ( 'Actual & Forecast Project Resources'[Consolidated FTEs] ),
                            'Actual & Forecast Project Resources'[Final Consolidated Hours Type] = "Approved"
                        ) > 0,
                        CALCULATE (
                            SUM ( 'Actual & Forecast Project Resources'[Consolidated FTEs] ),
                            'Actual & Forecast Project Resources'[Final Consolidated Hours Type] = "Approved"
                        ),
                        0
                    )
            ),
            [Median FTEs]
        ),
        DATESINPERIOD (
            'Actual & Forecast Project Resources'[Work Week Ending Date],
            MAX ( 'Date'[EndOfThisWeek] ) - 1,
            3,
            MONTH
        )
    )
RETURN
    MedianValueDiscipline

 

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.